qemuDomainUnshareNamespace: Use automatic memory clearing for string lists

'devMountsPath' and 'devMountsSavePath' are NULL terminated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-08-03 13:01:04 +02:00
parent 1b3c391a55
commit 65b918432e

View 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;
}