render / rpms / libvirt

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