summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2019-04-25 13:54:12 -0400
committerSteve Dickson <steved@redhat.com>2019-04-25 13:54:12 -0400
commiteee5640166dba8870b4b8fe03dbb9858edc7073c (patch)
tree8c86bf3693360a0557edf3462690ab8c836f37aa
parenta82db7139c1ef1ea264ce0a59496a3a73d70a22c (diff)
downloadnfs-utils-eee5640166dba8870b4b8fe03dbb9858edc7073c.tar.gz
Removed resource leaks from nfsidmap/static.c
nfsidmap/static.c:350: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:358: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:382: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:390: leaked_storage: Variable "gnode" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--support/nfsidmap/static.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/support/nfsidmap/static.c b/support/nfsidmap/static.c
index f7b8a67..30453d8 100644
--- a/support/nfsidmap/static.c
+++ b/support/nfsidmap/static.c
@@ -347,6 +347,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *unode);
free(pw);
+ conf_free_list(princ_list);
return -ENOMEM;
}
unode->uid = pw->pw_uid;
@@ -355,6 +356,7 @@ static int static_init(void) {
unode->localname = conf_get_str("Static", cln->field);
if (!unode->localname) {
free(pw);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -379,6 +381,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *gnode);
free(gr);
+ conf_free_list(princ_list);
return -ENOMEM;
}
gnode->gid = gr->gr_gid;
@@ -387,6 +390,9 @@ static int static_init(void) {
gnode->localgroup = conf_get_str("Static", cln->field);
if (!gnode->localgroup) {
free(gr);
+ free(gnode->principal);
+ free(gnode);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -394,6 +400,8 @@ static int static_init(void) {
LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
}
+
+ conf_free_list(princ_list);
return 0;
}