From 65b918432e3c2ce7ad0de2c70b409808e9032deb Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 3 Aug 2021 13:01:04 +0200 Subject: [PATCH] qemuDomainUnshareNamespace: Use automatic memory clearing for string lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'devMountsPath' and 'devMountsSavePath' are NULL terminated. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- 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; }