[libvirt PATCH 20/39] cpu_x86: Use g_auto* in virCPUx86CheckFeature

Jiri Denemark posted 39 patches 5 years, 10 months ago
[libvirt PATCH 20/39] cpu_x86: Use g_auto* in virCPUx86CheckFeature
Posted by Jiri Denemark 5 years, 10 months ago
Signed-off-by: Jiri Denemark <jdenemar@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 431fbd8ec6..3b3a428ecd 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -2282,21 +2282,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.0

Re: [libvirt PATCH 20/39] cpu_x86: Use g_auto* in virCPUx86CheckFeature
Posted by Ján Tomko 5 years, 10 months ago
On a Friday in 2020, Jiri Denemark wrote:
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/cpu/cpu_x86.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano