From a96d5bdc7d2d2de7b35820530f0665dda3c66c68 Mon Sep 17 00:00:00 2001 Message-Id: From: Jiri Denemark 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 Reviewed-by: Ján Tomko (cherry picked from commit a32a3e934f5e7769dc9d12a221f344319200b435) https://bugzilla.redhat.com/show_bug.cgi?id=1840010 Signed-off-by: Jiri Denemark Message-Id: <240a340d63d1c8612e58c2d5c52970291f3e7b6d.1590483392.git.jdenemar@redhat.com> Reviewed-by: Ján Tomko --- 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(©); } -- 2.26.2