[PATCH 08/19] Removed resource leaks from nfsidmap/libnfsidmap.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nfsidmap/libnfsidmap.c:410: leaked_storage: Variable "nfs4_methods"
	going out of scope leaks the storage it points to.

ibnfsidmap.c:483: leaked_storage: Variable "gss_methods"
	going out of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 support/nfsidmap/libnfsidmap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index 35ddf01..7b8a871 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -406,8 +406,10 @@ int nfs4_init_name_mapping(char *conffile)
 	nfs4_methods = conf_get_list("Translation", "Method");
 	if (nfs4_methods) {
 		IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list"));
-		if (load_plugins(nfs4_methods, &nfs4_plugins) == -1)
+		if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) {
+			conf_free_list(nfs4_methods);
 			return -ENOENT;
+		}
 	} else {
 		struct conf_list list;
 		struct conf_list_node node;
@@ -475,11 +477,15 @@ out:
 	if (ret) {
 		if (nfs4_plugins)
 			unload_plugins(nfs4_plugins);
-		if (gss_plugins)
+		if (gss_plugins) {
 			unload_plugins(gss_plugins);
+		}
 		nfs4_plugins = gss_plugins = NULL;
 	}
 
+	if (gss_methods)
+		conf_free_list(gss_methods);
+
 	return ret ? -ENOENT: 0;
 }
 
-- 
2.20.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux