mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Use g_auto for stealing virCaps
Convert all the functions that generate virCaps to use g_auto and g_steal_pointer. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -86,7 +86,7 @@ static virCaps *
|
||||
testGetCaps(char *capsData, const testQemuData *data)
|
||||
{
|
||||
g_autoptr(virQEMUCaps) qemuCaps = NULL;
|
||||
virCaps *caps = NULL;
|
||||
g_autoptr(virCaps) caps = NULL;
|
||||
virArch arch = virArchFromString(data->archName);
|
||||
g_autofree char *binary = NULL;
|
||||
|
||||
@@ -110,10 +110,9 @@ testGetCaps(char *capsData, const testQemuData *data)
|
||||
goto error;
|
||||
}
|
||||
|
||||
return caps;
|
||||
return g_steal_pointer(&caps);
|
||||
|
||||
error:
|
||||
virObjectUnref(caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
static virCaps *
|
||||
testXLInitCaps(void)
|
||||
{
|
||||
virCaps *caps;
|
||||
g_autoptr(virCaps) caps = NULL;
|
||||
virCapsGuest *guest;
|
||||
virCapsGuestMachine **machines;
|
||||
int nmachines;
|
||||
@@ -68,11 +68,10 @@ testXLInitCaps(void)
|
||||
|
||||
virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_XEN,
|
||||
NULL, NULL, 0, NULL);
|
||||
return caps;
|
||||
return g_steal_pointer(&caps);
|
||||
|
||||
cleanup:
|
||||
virCapabilitiesFreeMachines(machines, nmachines);
|
||||
virObjectUnref(caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user