Blame SOURCES/autofs-5.0.7-fix-memory-leak-in-get_dc_list.patch

306fa1
autofs-5.0.7 - fix memory leak in get_dc_list()
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
In get_dc_list() if an invalid port is found the allocated list storage
306fa1
isn't freed on the error exit.
306fa1
---
306fa1
 modules/dclist.c |    2 ++
306fa1
 1 file changed, 2 insertions(+)
306fa1
306fa1
diff --git a/modules/dclist.c b/modules/dclist.c
306fa1
index d16b913..af21ce0 100644
306fa1
--- a/modules/dclist.c
306fa1
+++ b/modules/dclist.c
306fa1
@@ -536,6 +536,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
306fa1
 		else
306fa1
 			strcat(tmp, " ");
306fa1
 
306fa1
+		list = NULL;
306fa1
 		for (i = 0; i < numdcs; i++) {
306fa1
 			if (i > 0)
306fa1
 				strcat(tmp, " ");
306fa1
@@ -549,6 +550,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
306fa1
 					error(logopt,
306fa1
 					      "invalid port: %u", dcs[i].port);
306fa1
 					free_srv_rrs(dcs, numdcs);
306fa1
+					free(tmp);
306fa1
 					goto out_error;
306fa1
 				}
306fa1
 				strcat(tmp, port);