virLXCProcessSetupNamespaceName: Fix potential uninitialized free of 'path'

'path' could be accessed uninitialized. Fix it by using g_autofree which
also mandates initialization.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-03-05 09:25:35 +01:00
parent 78ead2529b
commit 140c756f5c

View File

@ -409,7 +409,7 @@ static int virLXCProcessSetupNamespaceName(virLXCDriverPtr driver,
int fd = -1;
virDomainObjPtr vm;
virLXCDomainObjPrivatePtr priv;
char *path;
g_autofree char *path = NULL;
vm = virDomainObjListFindByName(driver->domains, name);
if (!vm) {
@ -436,7 +436,6 @@ static int virLXCProcessSetupNamespaceName(virLXCDriverPtr driver,
}
cleanup:
VIR_FREE(path);
virDomainObjEndAPI(&vm);
return fd;
}