render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 0b64dac1a3a9ef9cdfe3446ebbe114da1ae86e97 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <0b64dac1a3a9ef9cdfe3446ebbe114da1ae86e97@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:19 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86GetHost
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 4a7f6f43a2a6144780d7ab74b8a6f6b008a7aa9d)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <94056710375d491c42d12a46b20f670453c2a1c8.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 14 ++++++--------
a41c76
 1 file changed, 6 insertions(+), 8 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 0aebe534e6..1ade53a4a8 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -2637,18 +2637,18 @@ static int
a41c76
 virCPUx86GetHost(virCPUDefPtr cpu,
a41c76
                  virDomainCapsCPUModelsPtr models)
a41c76
 {
a41c76
-    virCPUDataPtr cpuData = NULL;
a41c76
-    int ret = -1;
a41c76
+    g_autoptr(virCPUData) cpuData = NULL;
a41c76
+    int ret;
a41c76
 
a41c76
     if (virCPUx86DriverInitialize() < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (!(cpuData = virCPUDataNew(archs[0])))
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (cpuidSet(CPUX86_BASIC, cpuData) < 0 ||
a41c76
         cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     /* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported.
a41c76
      * This is best effort since there might be no way to read the MSR
a41c76
@@ -2668,7 +2668,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
a41c76
             };
a41c76
 
a41c76
             if (virCPUx86DataAdd(cpuData, &item) < 0)
a41c76
-                goto cleanup;
a41c76
+                return -1;
a41c76
         }
a41c76
     }
a41c76
 
a41c76
@@ -2684,8 +2684,6 @@ virCPUx86GetHost(virCPUDefPtr cpu,
a41c76
         VIR_DEBUG("Host CPU does not support invariant TSC");
a41c76
     }
a41c76
 
a41c76
- cleanup:
a41c76
-    virCPUx86DataFree(cpuData);
a41c76
     return ret;
a41c76
 }
a41c76
 #endif
a41c76
-- 
a41c76
2.26.2
a41c76