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

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