Blame SOURCES/autofs-5.1.8-fix-memory-leak-in-update_hosts_mounts.patch

5a83b1
autofs-5.1.8 - fix memory leak in update_hosts_mounts()
5a83b1
5a83b1
From: Ian Kent <raven@themaw.net>
5a83b1
5a83b1
Coverity has reported a memory leak in update_hosts_mounts() introduced
5a83b1
by the map reload deadlock fix.
5a83b1
5a83b1
Signed-off-by: Ian Kent <raven@themaw.net>
5a83b1
---
5a83b1
 CHANGELOG              |    1 +
5a83b1
 modules/lookup_hosts.c |   13 +++++++------
5a83b1
 2 files changed, 8 insertions(+), 6 deletions(-)
5a83b1
5a83b1
--- autofs-5.1.7.orig/CHANGELOG
5a83b1
+++ autofs-5.1.7/CHANGELOG
5a83b1
@@ -109,6 +109,7 @@
5a83b1
 - coverity fix for invalid access.
5a83b1
 - fix hosts map deadlock on restart.
5a83b1
 - fix deadlock with hosts map reload.
5a83b1
+- fix memory leak in update_hosts_mounts().
5a83b1
 
5a83b1
 25/01/2021 autofs-5.1.7
5a83b1
 - make bind mounts propagation slave by default.
5a83b1
--- autofs-5.1.7.orig/modules/lookup_hosts.c
5a83b1
+++ autofs-5.1.7/modules/lookup_hosts.c
5a83b1
@@ -307,20 +307,21 @@ next:
5a83b1
 	}
5a83b1
 	pthread_cleanup_pop(1);
5a83b1
 
5a83b1
-	while (head) {
5a83b1
+	entries = head;
5a83b1
+	while (entries) {
5a83b1
 		debug(ap->logopt, MODPREFIX
5a83b1
-		      "attempt to update exports for %s", head->key);
5a83b1
+		      "attempt to update exports for %s", entries->key);
5a83b1
 
5a83b1
 		master_source_current_wait(ap->entry);
5a83b1
 		ap->entry->current = source;
5a83b1
 		ap->flags |= MOUNT_FLAG_REMOUNT;
5a83b1
-		ret = ctxt->parse->parse_mount(ap, head->key, strlen(head->key),
5a83b1
-					       head->entry, ctxt->parse->context);
5a83b1
+		ret = ctxt->parse->parse_mount(ap, entries->key, strlen(entries->key),
5a83b1
+					       entries->entry, ctxt->parse->context);
5a83b1
 		if (ret)
5a83b1
 			warn(ap->logopt, MODPREFIX
5a83b1
-			     "failed to parse mount %s", head->entry);
5a83b1
+			     "failed to parse mount %s", entries->entry);
5a83b1
 		ap->flags &= ~MOUNT_FLAG_REMOUNT;
5a83b1
-		head = head->next;
5a83b1
+		entries = entries->next;
5a83b1
 	}
5a83b1
 	pthread_cleanup_pop(1);
5a83b1
 }