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