mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
tests: use g_auto in qemuTestParseCapabilitiesArch
Refactor qemuTestParseCapabilitiesArch to use g_auto for cleanup. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
693831a58d
commit
0447e6243b
@ -304,19 +304,15 @@ virQEMUCaps *
|
|||||||
qemuTestParseCapabilitiesArch(virArch arch,
|
qemuTestParseCapabilitiesArch(virArch arch,
|
||||||
const char *capsFile)
|
const char *capsFile)
|
||||||
{
|
{
|
||||||
virQEMUCaps *qemuCaps = NULL;
|
g_autoptr(virQEMUCaps) qemuCaps = NULL;
|
||||||
g_autofree char *binary = g_strdup_printf("/usr/bin/qemu-system-%s",
|
g_autofree char *binary = g_strdup_printf("/usr/bin/qemu-system-%s",
|
||||||
virArchToString(arch));
|
virArchToString(arch));
|
||||||
|
|
||||||
if (!(qemuCaps = virQEMUCapsNewBinary(binary)) ||
|
if (!(qemuCaps = virQEMUCapsNewBinary(binary)) ||
|
||||||
virQEMUCapsLoadCache(arch, qemuCaps, capsFile, true) < 0)
|
virQEMUCapsLoadCache(arch, qemuCaps, capsFile, true) < 0)
|
||||||
goto error;
|
|
||||||
|
|
||||||
return qemuCaps;
|
|
||||||
|
|
||||||
error:
|
|
||||||
virObjectUnref(qemuCaps);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
return g_steal_pointer(&qemuCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user