]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_x86: Use g_auto* in virCPUx86CheckFeature
authorJiri Denemark <jdenemar@redhat.com>
Wed, 25 Mar 2020 10:31:29 +0000 (11:31 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 8 Apr 2020 15:41:01 +0000 (17:41 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_x86.c

index afdde24754f84c4639b69972e9b7a97a91f6ca3d..3bb212a9097a298654313356339601eb298b3b3d 100644 (file)
@@ -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);
 }