From 91a87dbe3a25e405ea5fbd87e4444ca77d04a34c Mon Sep 17 00:00:00 2001 Message-Id: <91a87dbe3a25e405ea5fbd87e4444ca77d04a34c@dist-git> From: Jiri Denemark Date: Tue, 26 May 2020 10:59:11 +0200 Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86LoadMap 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 3c650a8f7a89046b925fb5ddc78c4b6669ed76ef) https://bugzilla.redhat.com/show_bug.cgi?id=1840010 Signed-off-by: Jiri Denemark Message-Id: <63da1b86ef1c4f174234ff34e43d502afe326a2b.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 20cdd24390..cb5a2f941e 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1559,18 +1559,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree); static virCPUx86MapPtr virCPUx86LoadMap(void) { - virCPUx86MapPtr map; + g_autoptr(virCPUx86Map) map = NULL; map = g_new0(virCPUx86Map, 1); if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0) - goto error; - - return map; + return NULL; - error: - x86MapFree(map); - return NULL; + return g_steal_pointer(&map); } -- 2.26.2