[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt PATCH 04/15] cpu: Use g_auto* in virCPUCompareXML



Signed-off-by: Tim Wiederhake <twiederh redhat com>
---
 src/cpu/cpu.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index d502c02f51..a84eb10cc4 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -111,21 +111,15 @@ virCPUCompareXML(virArch arch,
                  const char *xml,
                  bool failIncompatible)
 {
-    virCPUDefPtr cpu = NULL;
-    virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
+    g_autoptr(virCPUDef) cpu = NULL;
 
     VIR_DEBUG("arch=%s, host=%p, xml=%s",
               virArchToString(arch), host, NULLSTR(xml));
 
     if (virCPUDefParseXMLString(xml, VIR_CPU_TYPE_AUTO, &cpu) < 0)
-        goto cleanup;
-
-    ret = virCPUCompare(arch, host, cpu, failIncompatible);
-
- cleanup:
-    virCPUDefFree(cpu);
+        return VIR_CPU_COMPARE_ERROR;
 
-    return ret;
+    return virCPUCompare(arch, host, cpu, failIncompatible);
 }
 
 
-- 
2.26.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]