Blame SOURCES/autofs-5.1.7-fix-possible-memory-leak-in-master_parse.patch

29d2b9
autofs-5.1.7 - fix possible memory leak in master_parse()
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
Coverity: Overwriting "path" in "path = master_strdup(yyvsp[-1].strtype)"
29d2b9
	  leaks the storage that "path" points to.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG             |    1 +
29d2b9
 daemon/master_parse.y |    2 ++
29d2b9
 2 files changed, 3 insertions(+)
29d2b9
29d2b9
diff --git a/CHANGELOG b/CHANGELOG
29d2b9
index 2186cbe3..b797f6dc 100644
29d2b9
--- a/CHANGELOG
29d2b9
+++ b/CHANGELOG
29d2b9
@@ -52,6 +52,7 @@
29d2b9
 - remove unused variable from get_exports().
29d2b9
 - add missing free in handle_mounts().
29d2b9
 - remove redundant if check.
29d2b9
+- fix possible memory leak in master_parse().
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
diff --git a/daemon/master_parse.y b/daemon/master_parse.y
29d2b9
index 08e44b57..7480c36a 100644
29d2b9
--- a/daemon/master_parse.y
29d2b9
+++ b/daemon/master_parse.y
29d2b9
@@ -155,6 +155,8 @@ file: {
29d2b9
 line:
29d2b9
 	| PATH mapspec
29d2b9
 	{
29d2b9
+		if (path)
29d2b9
+			free(path);
29d2b9
 		path = master_strdup($1);
29d2b9
 		if (!path) {
29d2b9
 			local_free_vars();