cpu_x86: Use glib allocation for virCPUx86Vendor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2020-03-25 10:37:29 +01:00
parent 8008685830
commit 8a41417b23

View File

@ -830,9 +830,10 @@ x86VendorFree(virCPUx86VendorPtr vendor)
if (!vendor) if (!vendor)
return; return;
VIR_FREE(vendor->name); g_free(vendor->name);
VIR_FREE(vendor); g_free(vendor);
} }
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Vendor, x86VendorFree);
static virCPUx86VendorPtr static virCPUx86VendorPtr
@ -860,9 +861,7 @@ x86VendorParse(xmlXPathContextPtr ctxt,
char *string = NULL; char *string = NULL;
int ret = -1; int ret = -1;
if (VIR_ALLOC(vendor) < 0) vendor = g_new0(virCPUx86Vendor, 1);
goto cleanup;
vendor->name = g_strdup(name); vendor->name = g_strdup(name);
if (x86VendorFind(map, vendor->name)) { if (x86VendorFind(map, vendor->name)) {