[PATCH 2/5] qemuBuildNumaArgStr: Use g_autofree on @nodeBackends

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5af22e9359..5a438d07c3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7066,13 +7066,13 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
     size_t i, j;
     virQEMUCapsPtr qemuCaps = priv->qemuCaps;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    virBufferPtr nodeBackends = NULL;
+    g_autofree virBufferPtr nodeBackends = NULL;
     bool needBackend = false;
     int ret = -1;
     size_t ncells = virDomainNumaGetNodeCount(def->numa);
 
     if (!virDomainNumatuneNodesetIsAvailable(def->numa, priv->autoNodeset))
-        goto cleanup;
+        return -1;
 
     if (!virQEMUCapsGetMachineNumaMemSupported(qemuCaps,
                                                def->virtType,
@@ -7080,7 +7080,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
         needBackend = true;
 
     if (VIR_ALLOC_N(nodeBackends, ncells) < 0)
-        goto cleanup;
+        return -1;
 
     /* using of -numa memdev= cannot be combined with -numa mem=, thus we
      * need to check which approach to use */
@@ -7159,12 +7159,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
     ret = 0;
 
  cleanup:
-    if (nodeBackends) {
-        for (i = 0; i < ncells; i++)
-            virBufferFreeAndReset(&nodeBackends[i]);
-
-        VIR_FREE(nodeBackends);
-    }
+    for (i = 0; i < ncells; i++)
+        virBufferFreeAndReset(&nodeBackends[i]);
 
     return ret;
 }
-- 
2.26.2




[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