[PATCH 11/13] qemuDomainUnshareNamespace: Use automatic memory clearing for string lists

Peter Krempa pkrempa at redhat.com
Thu Aug 5 15:34:27 UTC 2021


'devMountsPath' and 'devMountsSavePath' are NULL terminated.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_namespace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index b2e6ecb71a..728d77fc61 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -682,7 +682,8 @@ qemuDomainUnshareNamespace(virQEMUDriverConfig *cfg,
                            virDomainObj *vm)
 {
     const char *devPath = NULL;
-    char **devMountsPath = NULL, **devMountsSavePath = NULL;
+    g_auto(GStrv) devMountsPath = NULL;
+    g_auto(GStrv) devMountsSavePath = NULL;
     size_t ndevMountsPath = 0, i;
     int ret = -1;

@@ -791,8 +792,6 @@ qemuDomainUnshareNamespace(virQEMUDriverConfig *cfg,
         else
             unlink(devMountsSavePath[i]);
     }
-    virStringListFreeCount(devMountsPath, ndevMountsPath);
-    virStringListFreeCount(devMountsSavePath, ndevMountsPath);
     return ret;
 }

-- 
2.31.1




More information about the libvir-list mailing list