mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
virResctrlAllocNewFromInfo: Use g_autoptr for 'ret'
Remove 'cleanup' and 'error' labels by switching 'ret' to automatic pointer and stealing it in the return statement. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
25d45433b8
commit
05350e451c
@ -1811,7 +1811,7 @@ static virResctrlAllocPtr
|
||||
virResctrlAllocNewFromInfo(virResctrlInfoPtr info)
|
||||
{
|
||||
size_t i = 0;
|
||||
virResctrlAllocPtr ret = virResctrlAllocNew();
|
||||
g_autoptr(virResctrlAlloc) ret = virResctrlAllocNew();
|
||||
|
||||
if (!ret)
|
||||
return NULL;
|
||||
@ -1836,7 +1836,7 @@ virResctrlAllocNewFromInfo(virResctrlInfoPtr info)
|
||||
|
||||
for (k = 0; k <= i_type->max_cache_id; k++) {
|
||||
if (virResctrlAllocUpdateMask(ret, i, j, k, mask) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1854,12 +1854,7 @@ virResctrlAllocNewFromInfo(virResctrlInfoPtr info)
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
error:
|
||||
virObjectUnref(ret);
|
||||
ret = NULL;
|
||||
goto cleanup;
|
||||
return g_steal_pointer(&ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user