[PATCH 09/11] xen_xl.c: Use g_autoptr() for virCPUDef

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

 



In xenParseXLVnuma() the @cpu variable is freed explicitly.
However, when switched to g_autoptr(virCPUDef) the explicit call
can be removed.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/libxl/xen_xl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 043f3c27db..25bf1f7893 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -396,7 +396,7 @@ xenParseXLVnuma(virConf *conf,
     size_t vcpus = 0;
     size_t nr_nodes = 0;
     size_t vnodeCnt = 0;
-    virCPUDef *cpu = NULL;
+    g_autoptr(virCPUDef) cpu = NULL;
     virConfValue *list;
     virConfValue *vnode;
     virDomainNuma *numa;
@@ -529,14 +529,11 @@ xenParseXLVnuma(virConf *conf,
     }
 
     cpu->type = VIR_CPU_TYPE_GUEST;
-    def->cpu = cpu;
+    def->cpu = g_steal_pointer(&cpu);
 
     ret = 0;
 
  cleanup:
-    if (ret)
-        VIR_FREE(cpu);
-
     return ret;
 }
 
-- 
2.34.1




[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