[libvirt PATCH 13/15] cpu_ppc64: Use g_auto* in virCPUppc64GetHost

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


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

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index d7ccd506fb..30dd5a48c5 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -605,17 +605,16 @@ static int
 virCPUppc64GetHost(virCPUDefPtr cpu,
                    virDomainCapsCPUModelsPtr models)
 {
-    virCPUDataPtr cpuData = NULL;
+    g_autoptr(virCPUData) cpuData = NULL;
     virCPUppc64Data *data;
-    int ret = -1;
 
     if (!(cpuData = virCPUDataNew(archs[0])))
-        goto cleanup;
+        return -1;
 
     data = &cpuData->data.ppc64;
 
     if (VIR_ALLOC_N(data->pvr, 1) < 0)
-        goto cleanup;
+        return -1;
 
     data->len = 1;
 
@@ -625,11 +624,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
 #endif
     data->pvr[0].mask = 0xfffffffful;
 
-    ret = ppc64DriverDecode(cpu, cpuData, models);
-
- cleanup:
-    virCPUppc64DataFree(cpuData);
-    return ret;
+    return ppc64DriverDecode(cpu, cpuData, models);
 }
 
 
-- 
2.26.2




More information about the libvir-list mailing list