render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From a96d5bdc7d2d2de7b35820530f0665dda3c66c68 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <a96d5bdc7d2d2de7b35820530f0665dda3c66c68@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:26 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86CopyMigratable
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 a32a3e934f5e7769dc9d12a221f344319200b435)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <240a340d63d1c8612e58c2d5c52970291f3e7b6d.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 10 +++-------
a41c76
 1 file changed, 3 insertions(+), 7 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 917cf857a6..b4b1b475d6 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -3109,7 +3109,7 @@ x86FeatureFilterMigratable(const char *name,
a41c76
 static virCPUDefPtr
a41c76
 virCPUx86CopyMigratable(virCPUDefPtr cpu)
a41c76
 {
a41c76
-    virCPUDefPtr copy;
a41c76
+    g_autoptr(virCPUDef) copy = NULL;
a41c76
     virCPUx86MapPtr map;
a41c76
 
a41c76
     if (!(map = virCPUx86GetMap()))
a41c76
@@ -3120,13 +3120,9 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
a41c76
 
a41c76
     if (virCPUDefCopyModelFilter(copy, cpu, false,
a41c76
                                  x86FeatureFilterMigratable, map) < 0)
a41c76
-        goto error;
a41c76
-
a41c76
-    return copy;
a41c76
+        return NULL;
a41c76
 
a41c76
- error:
a41c76
-    virCPUDefFree(copy);
a41c76
-    return NULL;
a41c76
+    return g_steal_pointer(©);
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76