render / rpms / libvirt

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