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

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