fbe740
From 9810efd43b52070c20fe41b41175b0afff6710aa Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <9810efd43b52070c20fe41b41175b0afff6710aa@dist-git>
fbe740
From: Jiri Denemark <jdenemar@redhat.com>
fbe740
Date: Tue, 26 May 2020 10:59:02 +0200
fbe740
Subject: [PATCH] cpu_x86: Use glib allocation for virCPUx86Feature
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 51b6e9c1000151cc515804134a00ccb0d7b3e44a)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
fbe740
fbe740
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
fbe740
Message-Id: <4c4090765c01f7359c521cb09d247b1694afbe9c.1590483392.git.jdenemar@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/cpu/cpu_x86.c | 22 ++++------------------
fbe740
 1 file changed, 4 insertions(+), 18 deletions(-)
fbe740
fbe740
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
fbe740
index aa66309b21..3a598e35d2 100644
fbe740
--- a/src/cpu/cpu_x86.c
fbe740
+++ b/src/cpu/cpu_x86.c
fbe740
@@ -893,28 +893,17 @@ x86VendorParse(xmlXPathContextPtr ctxt,
fbe740
 }
fbe740
 
fbe740
 
fbe740
-static virCPUx86FeaturePtr
fbe740
-x86FeatureNew(void)
fbe740
-{
fbe740
-    virCPUx86FeaturePtr feature;
fbe740
-
fbe740
-    if (VIR_ALLOC(feature) < 0)
fbe740
-        return NULL;
fbe740
-
fbe740
-    return feature;
fbe740
-}
fbe740
-
fbe740
-
fbe740
 static void
fbe740
 x86FeatureFree(virCPUx86FeaturePtr feature)
fbe740
 {
fbe740
     if (!feature)
fbe740
         return;
fbe740
 
fbe740
-    VIR_FREE(feature->name);
fbe740
+    g_free(feature->name);
fbe740
     virCPUx86DataClear(&feature->data);
fbe740
-    VIR_FREE(feature);
fbe740
+    g_free(feature);
fbe740
 }
fbe740
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Feature, x86FeatureFree);
fbe740
 
fbe740
 
fbe740
 static int
fbe740
@@ -1056,11 +1045,8 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
fbe740
     char *str = NULL;
fbe740
     int ret = -1;
fbe740
 
fbe740
-    if (!(feature = x86FeatureNew()))
fbe740
-        goto cleanup;
fbe740
-
fbe740
+    feature = g_new0(virCPUx86Feature, 1);
fbe740
     feature->migratable = true;
fbe740
-
fbe740
     feature->name = g_strdup(name);
fbe740
 
fbe740
     if (x86FeatureFind(map, feature->name)) {
fbe740
-- 
fbe740
2.26.2
fbe740