b971b8
From 2abd91246d3967f62473a9034f5d11f8e8ea8980 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <2abd91246d3967f62473a9034f5d11f8e8ea8980@dist-git>
b971b8
From: Jiri Denemark <jdenemar@redhat.com>
b971b8
Date: Tue, 26 May 2020 10:59:14 +0200
b971b8
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86Compare
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 bc62d7a49141d745b19d066c07599f228020a0b3)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Message-Id: <548eeddbf9eabf5e4a872390189bb0adf746c75f.1590483392.git.jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/cpu/cpu_x86.c | 16 +++++++---------
b971b8
 1 file changed, 7 insertions(+), 9 deletions(-)
b971b8
b971b8
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
b971b8
index 1a1c846383..c111ff45d4 100644
b971b8
--- a/src/cpu/cpu_x86.c
b971b8
+++ b/src/cpu/cpu_x86.c
b971b8
@@ -1847,32 +1847,30 @@ virCPUx86Compare(virCPUDefPtr host,
b971b8
                  virCPUDefPtr cpu,
b971b8
                  bool failIncompatible)
b971b8
 {
b971b8
-    virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
b971b8
-    char *message = NULL;
b971b8
+    virCPUCompareResult ret;
b971b8
+    g_autofree char *message = NULL;
b971b8
 
b971b8
     if (!host || !host->model) {
b971b8
         if (failIncompatible) {
b971b8
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
b971b8
                            _("unknown host CPU"));
b971b8
-        } else {
b971b8
-            VIR_WARN("unknown host CPU");
b971b8
-            ret = VIR_CPU_COMPARE_INCOMPATIBLE;
b971b8
+            return VIR_CPU_COMPARE_ERROR;
b971b8
         }
b971b8
-        goto cleanup;
b971b8
+
b971b8
+        VIR_WARN("unknown host CPU");
b971b8
+        return VIR_CPU_COMPARE_INCOMPATIBLE;
b971b8
     }
b971b8
 
b971b8
     ret = x86Compute(host, cpu, NULL, &message);
b971b8
 
b971b8
     if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
b971b8
-        ret = VIR_CPU_COMPARE_ERROR;
b971b8
         if (message)
b971b8
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
b971b8
         else
b971b8
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
b971b8
+        return VIR_CPU_COMPARE_ERROR;
b971b8
     }
b971b8
 
b971b8
- cleanup:
b971b8
-    VIR_FREE(message);
b971b8
     return ret;
b971b8
 }
b971b8
 
b971b8
-- 
b971b8
2.26.2
b971b8