[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt PATCH 07/15] cpu_ppc64: Use g_auto* in ppc64ModelCopy



Signed-off-by: Tim Wiederhake <twiederh 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 c7860cb1b4..9eaf9c6ae5 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -188,23 +188,19 @@ ppc64ModelFree(ppc64_model *model)
 static ppc64_model *
 ppc64ModelCopy(const ppc64_model *model)
 {
-    ppc64_model *copy;
+    g_autoptr(ppc64_model) copy = NULL;
 
     if (VIR_ALLOC(copy) < 0)
-        goto error;
+        return NULL;
 
     copy->name = g_strdup(model->name);
 
     if (ppc64DataCopy(&copy->data, &model->data) < 0)
-        goto error;
+        return NULL;
 
     copy->vendor = model->vendor;
 
-    return copy;
-
- error:
-    ppc64ModelFree(copy);
-    return NULL;
+    return g_steal_pointer(&copy);
 }
 
 static ppc64_model *
-- 
2.26.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]