render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From d151191af331a2127aa6b2126d15e2afd19e548d Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <d151191af331a2127aa6b2126d15e2afd19e548d@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:01 +0200
a41c76
Subject: [PATCH] cpu_x86: Use glib allocation for virCPUx86Vendor
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 8a41417b23dda97eb09bcd2921c1ab0d5fbce1b6)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <f5811f02d9c0cce74d007f5986454b8d89b2f548.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 9 ++++-----
a41c76
 1 file changed, 4 insertions(+), 5 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 4d82d85746..aa66309b21 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -830,9 +830,10 @@ x86VendorFree(virCPUx86VendorPtr vendor)
a41c76
     if (!vendor)
a41c76
         return;
a41c76
 
a41c76
-    VIR_FREE(vendor->name);
a41c76
-    VIR_FREE(vendor);
a41c76
+    g_free(vendor->name);
a41c76
+    g_free(vendor);
a41c76
 }
a41c76
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Vendor, x86VendorFree);
a41c76
 
a41c76
 
a41c76
 static virCPUx86VendorPtr
a41c76
@@ -860,9 +861,7 @@ x86VendorParse(xmlXPathContextPtr ctxt,
a41c76
     char *string = NULL;
a41c76
     int ret = -1;
a41c76
 
a41c76
-    if (VIR_ALLOC(vendor) < 0)
a41c76
-        goto cleanup;
a41c76
-
a41c76
+    vendor = g_new0(virCPUx86Vendor, 1);
a41c76
     vendor->name = g_strdup(name);
a41c76
 
a41c76
     if (x86VendorFind(map, vendor->name)) {
a41c76
-- 
a41c76
2.26.2
a41c76