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