libvirt/SOURCES/libvirt-cpu_x86-Use-g_auto-in-virCPUx86CopyMigratable.patch
2021-09-10 11:57:33 +00:00

55 lines
1.6 KiB
Diff

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