File autofs-5-1-3-fix-possible-map-instance-memory-leak.patch of Package autofs.23455
From: Ian Kent <raven@themaw.net>
Subject: autofs-5.1.3 - fix possible map instance memory leak
Patch-mainline: Submitted, https://www.spinics.net/lists/autofs/msg01706.html
References: bsc#1038198
When using a temporary map unconditionally updating the original map
instance pointer will lead to a memory leak when the instance pointer
is already set (among other problems).
Signed-off-by: Ian Kent <raven@themaw.net>
Acked-by: Jeff Mahoney <jeffm@suse.com>
---
daemon/lookup.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 583d3d37..569fffaf 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -536,7 +536,8 @@ static enum nsswitch_status read_map_source(struct nss_source *this,
result = read_file_source_instance(ap, &tmap, age);
pthread_cleanup_pop(1);
- map->instance = tmap.instance;
+ if (!map->instance)
+ map->instance = tmap.instance;
return result;
}
@@ -1089,7 +1090,8 @@ static enum nsswitch_status lookup_map_name(struct nss_source *this,
result = lookup_name_file_source_instance(ap, &tmap, name, name_len);
- map->instance = tmap.instance;
+ if (!map->instance)
+ map->instance = tmap.instance;
/* path is freed in free_argv */
free_argv(tmap.argc, tmap.argv);