2019-05-08 13:47:45

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 02/19] Removed resource leaks from nfs/exports.c

nfs/exports.c:717: leaked_storage: Variable "id" going out
of scope leaks the storage it points to.

nfs/exports.c:727: leaked_storage: Variable "id" going out
of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <[email protected]>
---
support/nfs/exports.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index b59d187..5f4cb95 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -714,6 +714,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
}
if (id0 == -1 || id1 == -1) {
syntaxerr("uid/gid -1 not permitted");
+ xfree(id);
return -1;
}
if ((len % 8) == 0)
@@ -724,6 +725,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
break;
if (*cp != ',') {
syntaxerr("bad uid/gid list");
+ xfree(id);
return -1;
}
cp++;
--
2.20.1