From 7dfa87aed33e37b825f0bbd7bf4a3c044dad1064 Mon Sep 17 00:00:00 2001 From: Yi Li Date: Wed, 10 Mar 2021 15:46:29 +0800 Subject: [PATCH] virQEMUCapsInitQMPArch: Refactor cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to using the 'g_auto*' helpers. Signed-off-by: Yi Li Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- 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; }