render / rpms / libvirt

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