Blob Blame History Raw
autofs-5.0.7 - try and cleanup after dumpmaps

From: Ian Kent <raven@themaw.net>

Try and cleanup a little after dumping maps.
It's not really necessary but but can help by reducing the noise
from valgrind when checking code.
---
 CHANGELOG          |    1 +
 daemon/automount.c |   13 +++++++++++++
 lib/master.c       |    2 ++
 3 files changed, 16 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -59,6 +59,7 @@
 - fix syncronize handle_mounts() shutdown.
 - fix fix wildcard multi map regression.
 - fix dumpmaps multi output.
+- try and cleanup after dumpmaps.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -2136,6 +2136,8 @@ int main(int argc, char *argv[])
 	}
 
 	if (dumpmaps) {
+		struct master_mapent *entry;
+		struct list_head *head, *p;
 		struct mapent_cache *nc;
 
 		open_log();
@@ -2152,6 +2154,17 @@ int main(int argc, char *argv[])
 
 		lookup_nss_read_master(master_list, 0);
 		master_show_mounts(master_list);
+
+		head = &master_list->mounts;
+		p = head->next;
+		while (p != head) {
+			entry = list_entry(p, struct master_mapent, list);
+			p = p->next;
+			master_free_mapent_sources(entry, 1);
+			master_free_mapent(entry);
+		}
+		master_kill(master_list);
+
 		exit(0);
 	}
 
--- autofs-5.0.7.orig/lib/master.c
+++ autofs-5.0.7/lib/master.c
@@ -1426,6 +1426,8 @@ int master_show_mounts(struct master *ma
 			source = source->next;
 		}
 
+		lookup_close_lookup(ap);
+
 		printf("\n");
 	}