render / rpms / libvirt

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