Blob Blame History Raw
autofs-5.1.7 - fix possible memory leak in master_parse()

From: Ian Kent <raven@themaw.net>

Coverity: Overwriting "path" in "path = master_strdup(yyvsp[-1].strtype)"
	  leaks the storage that "path" points to.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG             |    1 +
 daemon/master_parse.y |    2 ++
 2 files changed, 3 insertions(+)

--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -52,6 +52,7 @@
 - remove unused variable from get_exports().
 - add missing free in handle_mounts().
 - remove redundant if check.
+- fix possible memory leak in master_parse().
 
 xx/xx/2018 autofs-5.1.5
 - fix flag file permission.
--- autofs-5.1.4.orig/daemon/master_parse.y
+++ autofs-5.1.4/daemon/master_parse.y
@@ -155,6 +155,8 @@ file: {
 line:
 	| PATH mapspec
 	{
+		if (path)
+			free(path);
 		path = master_strdup($1);
 		if (!path) {
 			local_free_vars();