[libvirt PATCH 10/15] cpu_ppc64: Use g_auto* in ppc64LoadMap

Tim Wiederhake twiederh at redhat.com
Mon Sep 7 14:59:01 UTC 2020


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/cpu/cpu_ppc64.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 44420c9cd5..7b34fe6bbc 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -384,19 +384,15 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
 static ppc64_map *
 ppc64LoadMap(void)
 {
-    ppc64_map *map;
+    g_autoptr(ppc64_map) map = NULL;
 
     if (VIR_ALLOC(map) < 0)
-        goto error;
+        return NULL;
 
     if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) < 0)
-        goto error;
-
-    return map;
+        return NULL;
 
- error:
-    ppc64MapFree(map);
-    return NULL;
+    return g_steal_pointer(&map);
 }
 
 static virCPUDataPtr
-- 
2.26.2




More information about the libvir-list mailing list