Ian Kent ff6f3e
autofs-5.1.0 - fix leak in cache_push_mapent()
Ian Kent ff6f3e
Ian Kent ff6f3e
From: Ian Kent <raven@themaw.net>
Ian Kent ff6f3e
Ian Kent ff6f3e
cache_push_mapent() incorectly sets the cache entry mapent to the old
Ian Kent ff6f3e
value which causes a memory leak when the new map entry isn't NULL.
Ian Kent ff6f3e
---
Ian Kent ff6f3e
 CHANGELOG   |    1 +
Ian Kent ff6f3e
 lib/cache.c |    2 +-
Ian Kent ff6f3e
 2 files changed, 2 insertions(+), 1 deletion(-)
Ian Kent ff6f3e
Ian Kent ff6f3e
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent ff6f3e
index e911682..bc8b9d1 100644
Ian Kent ff6f3e
--- a/CHANGELOG
Ian Kent ff6f3e
+++ b/CHANGELOG
Ian Kent ff6f3e
@@ -5,6 +5,7 @@
Ian Kent ff6f3e
 - dont allocate dev_ctl_ops too early.
Ian Kent ff6f3e
 - fix incorrect round robin host detection.
Ian Kent ff6f3e
 - fix race accessing qdn in get_query_dn().
Ian Kent ff6f3e
+- fix leak in cache_push_mapent().
Ian Kent ff6f3e
 
Ian Kent ff6f3e
 04/06/2014 autofs-5.1.0
Ian Kent ff6f3e
 =======================
Ian Kent ff6f3e
diff --git a/lib/cache.c b/lib/cache.c
Ian Kent ff6f3e
index 8d08094..4bab5a3 100644
Ian Kent ff6f3e
--- a/lib/cache.c
Ian Kent ff6f3e
+++ b/lib/cache.c
Ian Kent ff6f3e
@@ -203,7 +203,7 @@ int cache_push_mapent(struct mapent *me, char *mapent)
Ian Kent ff6f3e
 
Ian Kent ff6f3e
 	s->mapent = me->mapent;
Ian Kent ff6f3e
 	s->age = me->age;
Ian Kent ff6f3e
-	me->mapent = mapent;
Ian Kent ff6f3e
+	me->mapent = new;
Ian Kent ff6f3e
 
Ian Kent ff6f3e
 	if (me->stack)
Ian Kent ff6f3e
 		s->next = me->stack;