render / rpms / libvirt

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