render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
b971b8
From a271a6a71073253a7dde518a63d5ee4965ee53d8 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <a271a6a71073253a7dde518a63d5ee4965ee53d8@dist-git>
b971b8
From: Jiri Denemark <jdenemar@redhat.com>
b971b8
Date: Tue, 26 May 2020 10:59:05 +0200
b971b8
Subject: [PATCH] cpu_x86: Use glib allocation in virCPUx86GetModels
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
(cherry picked from commit e43e2ff7f5b629f979e56387c4be46f2be251b75)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Message-Id: <1d1d9c9b60f1ea44a2252cb2fbfbf3886ecd245f.1590483392.git.jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/cpu/cpu_x86.c | 10 +---------
b971b8
 1 file changed, 1 insertion(+), 9 deletions(-)
b971b8
b971b8
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
b971b8
index 3711e03b3f..48f36c2bfc 100644
b971b8
--- a/src/cpu/cpu_x86.c
b971b8
+++ b/src/cpu/cpu_x86.c
b971b8
@@ -3121,21 +3121,13 @@ virCPUx86GetModels(char ***models)
b971b8
         return -1;
b971b8
 
b971b8
     if (models) {
b971b8
-        if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0)
b971b8
-            goto error;
b971b8
+        *models = g_new0(char *, map->nmodels + 1);
b971b8
 
b971b8
         for (i = 0; i < map->nmodels; i++)
b971b8
             (*models)[i] = g_strdup(map->models[i]->name);
b971b8
     }
b971b8
 
b971b8
     return map->nmodels;
b971b8
-
b971b8
- error:
b971b8
-    if (models) {
b971b8
-        virStringListFree(*models);
b971b8
-        *models = NULL;
b971b8
-    }
b971b8
-    return -1;
b971b8
 }
b971b8
 
b971b8
 
b971b8
-- 
b971b8
2.26.2
b971b8