Blame SOURCES/autofs-5.1.7-add-missing-free-in-handle_mounts.patch

29d2b9
autofs-5.1.7 - add missing free in handle_mounts()
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
Coverity: error[doubleFree]: Memory pointed to by 'root' is freed twice
29d2b9
29d2b9
No it's not, but root isn't freed before the fatal call which crashes
29d2b9
automount so add a free() before the fatal() call.
29d2b9
29d2b9
It appears Coverity doesn't recognise pthread_exit() as an exit condition.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG          |    1 +
29d2b9
 daemon/automount.c |    2 ++
29d2b9
 2 files changed, 3 insertions(+)
29d2b9
29d2b9
diff --git a/CHANGELOG b/CHANGELOG
29d2b9
index 9c3ede45..62a918a9 100644
29d2b9
--- a/CHANGELOG
29d2b9
+++ b/CHANGELOG
29d2b9
@@ -50,6 +50,7 @@
29d2b9
 - check for offset with no mount location.
29d2b9
 - remove mounts_mutex.
29d2b9
 - remove unused variable from get_exports().
29d2b9
+- add missing free in handle_mounts().
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
diff --git a/daemon/automount.c b/daemon/automount.c
29d2b9
index 28c4d1ee..48472d5f 100644
29d2b9
--- a/daemon/automount.c
29d2b9
+++ b/daemon/automount.c
29d2b9
@@ -1922,6 +1922,8 @@ void *handle_mounts(void *arg)
29d2b9
 	status = pthread_mutex_lock(&suc->mutex);
29d2b9
 	if (status) {
29d2b9
 		logerr("failed to lock startup condition mutex!");
29d2b9
+		if (root)
29d2b9
+			free(root);
29d2b9
 		fatal(status);
29d2b9
 	}
29d2b9