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