]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu_map: Use g_auto* in loadIncludes
authorTim Wiederhake <twiederh@redhat.com>
Mon, 7 Sep 2020 14:58:54 +0000 (16:58 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 8 Sep 2020 15:41:22 +0000 (17:41 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_map.c

index b0b3ce84310c62046b7ee1f985b61850c4d012f3..3abec68c60422abdddb5bf959c103f2796c600ed 100644 (file)
@@ -121,37 +121,31 @@ loadIncludes(xmlXPathContextPtr ctxt,
              cpuMapLoadCallback modelCB,
              void *data)
 {
-    int ret = -1;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
-    xmlNodePtr *nodes = NULL;
+    g_autofree xmlNodePtr *nodes = NULL;
     int n;
     size_t i;
 
     n = virXPathNodeSet("include", ctxt, &nodes);
     if (n < 0)
-        goto cleanup;
+        return -1;
 
     for (i = 0; i < n; i++) {
         char *filename = virXMLPropString(nodes[i], "filename");
         if (!filename) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Missing 'filename' in CPU map include"));
-            goto cleanup;
+            return -1;
         }
         VIR_DEBUG("Finding CPU map include '%s'", filename);
         if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data) < 0) {
             VIR_FREE(filename);
-            goto cleanup;
+            return -1;
         }
         VIR_FREE(filename);
     }
 
-    ret = 0;
-
- cleanup:
-    VIR_FREE(nodes);
-
-    return ret;
+    return 0;
 }