render / rpms / libvirt

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