]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Use g_auto* in x86ModelParse
authorJiri Denemark <jdenemar@redhat.com>
Wed, 25 Mar 2020 10:29:36 +0000 (11:29 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 8 Apr 2020 15:41:00 +0000 (17:41 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_x86.c

index 1f76fe1e5c45f6874b606aff3c708e0f44b094f5..983730f0c2577bb6790f047ed9e6422c74617a40 100644 (file)
@@ -1493,41 +1493,36 @@ x86ModelParse(xmlXPathContextPtr ctxt,
               void *data)
 {
     virCPUx86MapPtr map = data;
-    virCPUx86ModelPtr model = NULL;
-    int ret = -1;
+    g_autoptr(virCPUx86Model) model = NULL;
 
     if (x86ModelFind(map, name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Multiple definitions of CPU model '%s'"), name);
-        goto cleanup;
+        return -1;
     }
 
     model = g_new0(virCPUx86Model, 1);
     model->name = g_strdup(name);
 
     if (x86ModelParseDecode(model, ctxt) < 0)
-        goto cleanup;
+        return -1;
 
     if (x86ModelParseAncestor(model, ctxt, map) < 0)
-        goto cleanup;
+        return -1;
 
     if (x86ModelParseSignatures(model, ctxt) < 0)
-        goto cleanup;
+        return -1;
 
     if (x86ModelParseVendor(model, ctxt, map) < 0)
-        goto cleanup;
+        return -1;
 
     if (x86ModelParseFeatures(model, ctxt, map) < 0)
-        goto cleanup;
+        return -1;
 
     if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    x86ModelFree(model);
-    return ret;
+    return 0;
 }