render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 22d4493fd34661f4b93c8d4c885e627d561f2e70 Mon Sep 17 00:00:00 2001
Message-Id: <22d4493fd34661f4b93c8d4c885e627d561f2e70@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 26 May 2020 10:59:18 +0200
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86CheckFeature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3b5f1ca58e8f12bc7b768206cb9c7c2ef237e3ff)

https://bugzilla.redhat.com/show_bug.cgi?id=1840010

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <0834c0debe689b9b8a5f694738edc149856a08fa.1590483392.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/cpu/cpu_x86.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 56081145c0..0aebe534e6 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2278,21 +2278,16 @@ static int
 virCPUx86CheckFeature(const virCPUDef *cpu,
                       const char *name)
 {
-    int ret = -1;
     virCPUx86MapPtr map;
-    virCPUx86ModelPtr model = NULL;
+    g_autoptr(virCPUx86Model) model = NULL;
 
     if (!(map = virCPUx86GetMap()))
         return -1;
 
     if (!(model = x86ModelFromCPU(cpu, map, -1)))
-        goto cleanup;
-
-    ret = x86FeatureInData(name, &model->data, map);
+        return -1;
 
- cleanup:
-    x86ModelFree(model);
-    return ret;
+    return x86FeatureInData(name, &model->data, map);
 }
 
 
-- 
2.26.2