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

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