]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainUnshareNamespace: Use automatic memory clearing for string lists
authorPeter Krempa <pkrempa@redhat.com>
Tue, 3 Aug 2021 11:01:04 +0000 (13:01 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 9 Aug 2021 08:09:01 +0000 (10:09 +0200)
'devMountsPath' and 'devMountsSavePath' are NULL terminated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_namespace.c

index b2e6ecb71aebd0718d606598b0e09b4c59a2ff78..728d77fc6149d996ca9df2d73e2f5cdecc40b61c 100644 (file)
@@ -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;
 }