From: Jiri Denemark Date: Wed, 25 Mar 2020 09:37:29 +0000 (+0100) Subject: cpu_x86: Use glib allocation for virCPUx86Vendor X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8a41417b23dda97eb09bcd2921c1ab0d5fbce1b6;p=libvirt.git cpu_x86: Use glib allocation for virCPUx86Vendor Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 9e22c83c4d..5ffae3cebe 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -830,9 +830,10 @@ x86VendorFree(virCPUx86VendorPtr vendor) if (!vendor) return; - VIR_FREE(vendor->name); - VIR_FREE(vendor); + g_free(vendor->name); + g_free(vendor); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Vendor, x86VendorFree); static virCPUx86VendorPtr @@ -860,9 +861,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, char *string = NULL; int ret = -1; - if (VIR_ALLOC(vendor) < 0) - goto cleanup; - + vendor = g_new0(virCPUx86Vendor, 1); vendor->name = g_strdup(name); if (x86VendorFind(map, vendor->name)) {