render / rpms / libvirt

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