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

[libvirt PATCH v2 2/2] cpu_ppc64: Remove error path in virCPUppc64DriverGetModels



The call to `g_strfreev` is not required, as in both cases no memory has been allocated.

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

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 9e6f1e856e..28fbfea9ae 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -738,24 +738,17 @@ virCPUppc64DriverGetModels(char ***models)
     size_t i;
 
     if (!(map = ppc64LoadMap()))
-        goto error;
+        return -1;
 
     if (models) {
         if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0)
-            goto error;
+            return -1;
 
         for (i = 0; i < map->nmodels; i++)
             (*models)[i] = g_strdup(map->models[i]->name);
     }
 
     return map->nmodels;
-
- error:
-    if (models) {
-        g_strfreev(*models);
-        *models = NULL;
-    }
-    return -1;
 }
 
 struct cpuArchDriver cpuDriverPPC64 = {
-- 
2.26.2


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