Switch to using the 'g_auto*' helpers.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/qemu/qemu_capabilities.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 790375ac38..447cf77875 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5044,23 +5044,18 @@ static int
virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
- char *archstr = NULL;
- int ret = -1;
+ g_autofree char *archstr = NULL;
if (!(archstr = qemuMonitorGetTargetArch(mon)))
- goto cleanup;
+ return -1;
if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown QEMU arch %s"), archstr);
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- VIR_FREE(archstr);
- return ret;
+ return 0;
}
--
2.25.3