a41c76
From 91a87dbe3a25e405ea5fbd87e4444ca77d04a34c Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <91a87dbe3a25e405ea5fbd87e4444ca77d04a34c@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:11 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86LoadMap
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 3c650a8f7a89046b925fb5ddc78c4b6669ed76ef)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <63da1b86ef1c4f174234ff34e43d502afe326a2b.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 10 +++-------
a41c76
 1 file changed, 3 insertions(+), 7 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 20cdd24390..cb5a2f941e 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1559,18 +1559,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree);
a41c76
 static virCPUx86MapPtr
a41c76
 virCPUx86LoadMap(void)
a41c76
 {
a41c76
-    virCPUx86MapPtr map;
a41c76
+    g_autoptr(virCPUx86Map) map = NULL;
a41c76
 
a41c76
     map = g_new0(virCPUx86Map, 1);
a41c76
 
a41c76
     if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0)
a41c76
-        goto error;
a41c76
-
a41c76
-    return map;
a41c76
+        return NULL;
a41c76
 
a41c76
- error:
a41c76
-    x86MapFree(map);
a41c76
-    return NULL;
a41c76
+    return g_steal_pointer(&map);
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76