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

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