render / rpms / libvirt

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