virnetworkobj: Free retval of virNetworkObjGetPortStatusDir()

The virNetworkObjGetPortStatusDir() function allocates a memory
to construct a path. None of the callers free it leading to a
memleak.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2019-07-09 16:46:31 +02:00
parent 975b004d07
commit 37d8d6b98d

View File

@ -1627,7 +1627,7 @@ virNetworkObjAddPort(virNetworkObjPtr net,
{
int ret = -1;
char uuidstr[VIR_UUID_STRING_BUFLEN];
char *dir = NULL;
VIR_AUTOFREE(char *) dir = NULL;
virUUIDFormat(portdef->uuid, uuidstr);
@ -1717,7 +1717,7 @@ int
virNetworkObjDeleteAllPorts(virNetworkObjPtr net,
const char *stateDir)
{
char *dir;
VIR_AUTOFREE(char *) dir = NULL;
DIR *dh = NULL;
struct dirent *de;
int rc;
@ -1843,7 +1843,7 @@ static int
virNetworkObjLoadAllPorts(virNetworkObjPtr net,
const char *stateDir)
{
char *dir;
VIR_AUTOFREE(char *) dir = NULL;
DIR *dh = NULL;
struct dirent *de;
int ret = -1;