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(a)redhat.com>
---
src/conf/virnetworkobj.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 12cefebaa8..45726e4016 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -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;
--
2.21.0