b971b8
From 22d4493fd34661f4b93c8d4c885e627d561f2e70 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <22d4493fd34661f4b93c8d4c885e627d561f2e70@dist-git>
b971b8
From: Jiri Denemark <jdenemar@redhat.com>
b971b8
Date: Tue, 26 May 2020 10:59:18 +0200
b971b8
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86CheckFeature
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 3b5f1ca58e8f12bc7b768206cb9c7c2ef237e3ff)
b971b8
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
b971b8
b971b8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b971b8
Message-Id: <0834c0debe689b9b8a5f694738edc149856a08fa.1590483392.git.jdenemar@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/cpu/cpu_x86.c | 11 +++--------
b971b8
 1 file changed, 3 insertions(+), 8 deletions(-)
b971b8
b971b8
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
b971b8
index 56081145c0..0aebe534e6 100644
b971b8
--- a/src/cpu/cpu_x86.c
b971b8
+++ b/src/cpu/cpu_x86.c
b971b8
@@ -2278,21 +2278,16 @@ static int
b971b8
 virCPUx86CheckFeature(const virCPUDef *cpu,
b971b8
                       const char *name)
b971b8
 {
b971b8
-    int ret = -1;
b971b8
     virCPUx86MapPtr map;
b971b8
-    virCPUx86ModelPtr model = NULL;
b971b8
+    g_autoptr(virCPUx86Model) model = NULL;
b971b8
 
b971b8
     if (!(map = virCPUx86GetMap()))
b971b8
         return -1;
b971b8
 
b971b8
     if (!(model = x86ModelFromCPU(cpu, map, -1)))
b971b8
-        goto cleanup;
b971b8
-
b971b8
-    ret = x86FeatureInData(name, &model->data, map);
b971b8
+        return -1;
b971b8
 
b971b8
- cleanup:
b971b8
-    x86ModelFree(model);
b971b8
-    return ret;
b971b8
+    return x86FeatureInData(name, &model->data, map);
b971b8
 }
b971b8
 
b971b8
 
b971b8
-- 
b971b8
2.26.2
b971b8