Blob Blame History Raw
autofs-5.1.7 - fix double free in parse_mapent()

From: Ian Kent <raven@themaw.net>

Coverity:
in parse_mapent(): double_free: Calling "free" frees pointer "newopt"
		   which has already been freed.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 modules/parse_sun.c |    2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ff3d88eb..81461978 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -62,6 +62,7 @@
 - fix dead code in mnts_add_mount().
 - fix arg not used in error print.
 - fix missing lock release in mount_subtree().
+- fix double free in parse_mapent().
 
 25/01/2021 autofs-5.1.7
 - make bind mounts propagation slave by default.
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 5d15f892..03a63290 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -974,8 +974,6 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
 					estr = strerror_r(errno, buf, MAX_ERR_BUF);
 					error(logopt, MODPREFIX
 					      "concat_options: %s", estr);
-					if (newopt)
-						free(newopt);
 					free(myoptions);
 					return 0;
 				}