render / rpms / libvirt

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