From: Peter Krempa Date: Tue, 3 Aug 2021 11:01:04 +0000 (+0200) Subject: qemuDomainUnshareNamespace: Use automatic memory clearing for string lists X-Git-Tag: v7.7.0-rc1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65b918432e3c2ce7ad0de2c70b409808e9032deb;p=thirdparty%2Flibvirt.git qemuDomainUnshareNamespace: Use automatic memory clearing for string lists 'devMountsPath' and 'devMountsSavePath' are NULL terminated. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- 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; }