[libvirt PATCH 28/39] cpu_x86: Use g_auto* in virCPUx86CopyMigratable

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/cpu/cpu_x86.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index a65215caed..16e73b5b98 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -3113,7 +3113,7 @@ x86FeatureFilterMigratable(const char *name,
 static virCPUDefPtr
 virCPUx86CopyMigratable(virCPUDefPtr cpu)
 {
-    virCPUDefPtr copy;
+    g_autoptr(virCPUDef) copy = NULL;
     virCPUx86MapPtr map;
 
     if (!(map = virCPUx86GetMap()))
@@ -3124,13 +3124,9 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
 
     if (virCPUDefCopyModelFilter(copy, cpu, false,
                                  x86FeatureFilterMigratable, map) < 0)
-        goto error;
-
-    return copy;
+        return NULL;
 
- error:
-    virCPUDefFree(copy);
-    return NULL;
+    return g_steal_pointer(&copy);
 }
 
 
-- 
2.26.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux