render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 2545e373c4a5b08836742742960244ece2586545 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <2545e373c4a5b08836742742960244ece2586545@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:21 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in x86UpdateHostModel
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 2f9d15b495efdd9e63c07cd6fda611701e71ee46)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <f39c8eb1774d8c9af13a8af47689f8759ce57cb3.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 14 +++++---------
a41c76
 1 file changed, 5 insertions(+), 9 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 6e7311694d..98f7863b6f 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -2817,17 +2817,16 @@ static int
a41c76
 x86UpdateHostModel(virCPUDefPtr guest,
a41c76
                    const virCPUDef *host)
a41c76
 {
a41c76
-    virCPUDefPtr updated = NULL;
a41c76
+    g_autoptr(virCPUDef) updated = NULL;
a41c76
     size_t i;
a41c76
-    int ret = -1;
a41c76
 
a41c76
     if (!(updated = virCPUDefCopyWithoutModel(host)))
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     updated->type = VIR_CPU_TYPE_GUEST;
a41c76
     updated->mode = VIR_CPU_MODE_CUSTOM;
a41c76
     if (virCPUDefCopyModel(updated, host, true) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (guest->vendor_id) {
a41c76
         VIR_FREE(updated->vendor_id);
a41c76
@@ -2838,18 +2837,15 @@ x86UpdateHostModel(virCPUDefPtr guest,
a41c76
         if (virCPUDefUpdateFeature(updated,
a41c76
                                    guest->features[i].name,
a41c76
                                    guest->features[i].policy) < 0)
a41c76
-            goto cleanup;
a41c76
+            return -1;
a41c76
     }
a41c76
 
a41c76
     virCPUDefStealModel(guest, updated,
a41c76
                         guest->mode == VIR_CPU_MODE_CUSTOM);
a41c76
     guest->mode = VIR_CPU_MODE_CUSTOM;
a41c76
     guest->match = VIR_CPU_MATCH_EXACT;
a41c76
-    ret = 0;
a41c76
 
a41c76
- cleanup:
a41c76
-    virCPUDefFree(updated);
a41c76
-    return ret;
a41c76
+    return 0;
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76