[libvirt PATCH 08/15] cpu_ppc64: Use g_auto* in ppc64VendorParse

Tim Wiederhake twiederh at redhat.com
Mon Sep 7 14:58:59 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/cpu/cpu_ppc64.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 9eaf9c6ae5..81c3ce8319 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -281,8 +281,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
                  void *data)
 {
     ppc64_map *map = data;
-    ppc64_vendor *vendor;
-    int ret = -1;
+    g_autoptr(ppc64_vendor) vendor = NULL;
 
     if (VIR_ALLOC(vendor) < 0)
         return -1;
@@ -292,17 +291,13 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
     if (ppc64VendorFind(map, vendor->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("CPU vendor %s already defined"), vendor->name);
-        goto cleanup;
+        return -1;
     }
 
     if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    ppc64VendorFree(vendor);
-    return ret;
+    return 0;
 }
 
 
-- 
2.26.2




More information about the libvir-list mailing list