Refactor qemuTestParseCapabilitiesArch to use g_auto fro cleanup.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tests/testutilsqemu.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 81d4a44f9a..ea9a283297 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -304,19 +304,15 @@ virQEMUCaps *
qemuTestParseCapabilitiesArch(virArch arch,
const char *capsFile)
{
- virQEMUCaps *qemuCaps = NULL;
+ g_autoptr(virQEMUCaps) qemuCaps = NULL;
g_autofree char *binary = g_strdup_printf("/usr/bin/qemu-system-%s",
virArchToString(arch));
if (!(qemuCaps = virQEMUCapsNewBinary(binary)) ||
virQEMUCapsLoadCache(arch, qemuCaps, capsFile, true) < 0)
- goto error;
+ return NULL;
- return qemuCaps;
-
- error:
- virObjectUnref(qemuCaps);
- return NULL;
+ return g_steal_pointer(&qemuCaps);
}
--
2.31.1