render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
b971b8
From 9adc6c8a4450e5eab78d7a8abd14b0e460d23a08 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <9adc6c8a4450e5eab78d7a8abd14b0e460d23a08@dist-git>
b971b8
From: Jiri Denemark <jdenemar@redhat.com>
b971b8
Date: Tue, 26 May 2020 10:59:04 +0200
b971b8
Subject: [PATCH] cpu_x86: Use glib allocation for virCPUx86Map
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 247e115e2753bde7957cc07a20d5a48a8a6632b0)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Message-Id: <0e3dc412e6e755f75e39a9ec22b2b5549c82930e.1590483392.git.jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/cpu/cpu_x86.c | 14 +++++++-------
b971b8
 1 file changed, 7 insertions(+), 7 deletions(-)
b971b8
b971b8
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
b971b8
index 373c34a834..3711e03b3f 100644
b971b8
--- a/src/cpu/cpu_x86.c
b971b8
+++ b/src/cpu/cpu_x86.c
b971b8
@@ -1566,23 +1566,24 @@ x86MapFree(virCPUx86MapPtr map)
b971b8
 
b971b8
     for (i = 0; i < map->nfeatures; i++)
b971b8
         x86FeatureFree(map->features[i]);
b971b8
-    VIR_FREE(map->features);
b971b8
+    g_free(map->features);
b971b8
 
b971b8
     for (i = 0; i < map->nmodels; i++)
b971b8
         x86ModelFree(map->models[i]);
b971b8
-    VIR_FREE(map->models);
b971b8
+    g_free(map->models);
b971b8
 
b971b8
     for (i = 0; i < map->nvendors; i++)
b971b8
         x86VendorFree(map->vendors[i]);
b971b8
-    VIR_FREE(map->vendors);
b971b8
+    g_free(map->vendors);
b971b8
 
b971b8
     /* migrate_blockers only points to the features from map->features list,
b971b8
      * which were already freed above
b971b8
      */
b971b8
-    VIR_FREE(map->migrate_blockers);
b971b8
+    g_free(map->migrate_blockers);
b971b8
 
b971b8
-    VIR_FREE(map);
b971b8
+    g_free(map);
b971b8
 }
b971b8
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Map, x86MapFree);
b971b8
 
b971b8
 
b971b8
 static virCPUx86MapPtr
b971b8
@@ -1590,8 +1591,7 @@ virCPUx86LoadMap(void)
b971b8
 {
b971b8
     virCPUx86MapPtr map;
b971b8
 
b971b8
-    if (VIR_ALLOC(map) < 0)
b971b8
-        return NULL;
b971b8
+    map = g_new0(virCPUx86Map, 1);
b971b8
 
b971b8
     if (cpuMapLoad("x86", x86VendorParse, x86FeatureParse, x86ModelParse, map) < 0)
b971b8
         goto error;
b971b8
-- 
b971b8
2.26.2
b971b8