render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 3400f296861c822d2b0e6d3b31e878c69187f40e Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <3400f296861c822d2b0e6d3b31e878c69187f40e@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:10 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in x86ModelParse
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit b239a60967cc2979f01e4521d6582b7d6acedd72)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <ed4ff8e858f5f735a3a6e013188aca08e8a9a94a.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 23 +++++++++--------------
a41c76
 1 file changed, 9 insertions(+), 14 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 5215405755..20cdd24390 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1493,41 +1493,36 @@ x86ModelParse(xmlXPathContextPtr ctxt,
a41c76
               void *data)
a41c76
 {
a41c76
     virCPUx86MapPtr map = data;
a41c76
-    virCPUx86ModelPtr model = NULL;
a41c76
-    int ret = -1;
a41c76
+    g_autoptr(virCPUx86Model) model = NULL;
a41c76
 
a41c76
     if (x86ModelFind(map, name)) {
a41c76
         virReportError(VIR_ERR_INTERNAL_ERROR,
a41c76
                        _("Multiple definitions of CPU model '%s'"), name);
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
     }
a41c76
 
a41c76
     model = g_new0(virCPUx86Model, 1);
a41c76
     model->name = g_strdup(name);
a41c76
 
a41c76
     if (x86ModelParseDecode(model, ctxt) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (x86ModelParseAncestor(model, ctxt, map) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (x86ModelParseSignatures(model, ctxt) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (x86ModelParseVendor(model, ctxt, map) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (x86ModelParseFeatures(model, ctxt, map) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
a41c76
-        goto cleanup;
a41c76
-
a41c76
-    ret = 0;
a41c76
+        return -1;
a41c76
 
a41c76
- cleanup:
a41c76
-    x86ModelFree(model);
a41c76
-    return ret;
a41c76
+    return 0;
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76