]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virQEMUCapsInitQMPArch: Refactor cleanup
authorYi Li <yili@winhong.com>
Wed, 10 Mar 2021 07:46:29 +0000 (15:46 +0800)
committerJán Tomko <jtomko@redhat.com>
Wed, 10 Mar 2021 18:57:49 +0000 (19:57 +0100)
Switch to using the 'g_auto*' helpers.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c

index 790375ac38fde42bc3146688e2573ac9a9ac552a..447cf77875a1d8c54f19c19e30f63cd0865868d3 100644 (file)
@@ -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;
 }