|
|
a41c76 |
From 6a7bb46df53af5c1213e3a53a530c8745eb1aa0e Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <6a7bb46df53af5c1213e3a53a530c8745eb1aa0e@dist-git>
|
|
|
a41c76 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Date: Tue, 26 May 2020 10:59:07 +0200
|
|
|
a41c76 |
Subject: [PATCH] cpu_x86: Use g_auto* in x86VendorParse
|
|
|
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 6a0a7db9041cb1d8d92919bb4adf0d19bdd5dd68)
|
|
|
a41c76 |
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
a41c76 |
Message-Id: <3d21717ab7a594e301afc7f33ddbb32b57a8c56e.1590483392.git.jdenemar@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/cpu/cpu_x86.c | 20 +++++++-------------
|
|
|
a41c76 |
1 file changed, 7 insertions(+), 13 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
index 310dfcbcb3..3ffddf0342 100644
|
|
|
a41c76 |
--- a/src/cpu/cpu_x86.c
|
|
|
a41c76 |
+++ b/src/cpu/cpu_x86.c
|
|
|
a41c76 |
@@ -849,9 +849,8 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
|
|
a41c76 |
void *data)
|
|
|
a41c76 |
{
|
|
|
a41c76 |
virCPUx86MapPtr map = data;
|
|
|
a41c76 |
- virCPUx86VendorPtr vendor = NULL;
|
|
|
a41c76 |
- char *string = NULL;
|
|
|
a41c76 |
- int ret = -1;
|
|
|
a41c76 |
+ g_autoptr(virCPUx86Vendor) vendor = NULL;
|
|
|
a41c76 |
+ g_autofree char *string = NULL;
|
|
|
a41c76 |
|
|
|
a41c76 |
vendor = g_new0(virCPUx86Vendor, 1);
|
|
|
a41c76 |
vendor->name = g_strdup(name);
|
|
|
a41c76 |
@@ -859,7 +858,7 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
|
|
a41c76 |
if (x86VendorFind(map, vendor->name)) {
|
|
|
a41c76 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
a41c76 |
_("CPU vendor %s already defined"), vendor->name);
|
|
|
a41c76 |
- goto cleanup;
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
string = virXPathString("string(@string)", ctxt);
|
|
|
a41c76 |
@@ -867,21 +866,16 @@ x86VendorParse(xmlXPathContextPtr ctxt,
|
|
|
a41c76 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
a41c76 |
_("Missing vendor string for CPU vendor %s"),
|
|
|
a41c76 |
vendor->name);
|
|
|
a41c76 |
- goto cleanup;
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
if (virCPUx86VendorToData(string, &vendor->data) < 0)
|
|
|
a41c76 |
- goto cleanup;
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
|
|
|
a41c76 |
if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0)
|
|
|
a41c76 |
- goto cleanup;
|
|
|
a41c76 |
-
|
|
|
a41c76 |
- ret = 0;
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
|
|
|
a41c76 |
- cleanup:
|
|
|
a41c76 |
- x86VendorFree(vendor);
|
|
|
a41c76 |
- VIR_FREE(string);
|
|
|
a41c76 |
- return ret;
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.26.2
|
|
|
a41c76 |
|