render / rpms / libvirt

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