From 8e74848cff12ea9902c59081515d46fc51d6f545 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 5 Jan 2014 14:47:30 +0100 Subject: Fix memory leaks related to set_pop() Some pieces of code did not properly free() the value returned by set_pop(). The leak in group code was related to the introduction of nested group functionality in 41ba574 (merged in 3daa68d) so should only be present in releases 0.9.0 forward. The leak in the netgroup code only ended up in the Solaris version of the NSS module and was introduced in 4ea9ad1 (merged in 5c8779d). This leak is present in all releases from 0.8.0 forward. --- nss/netgroup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nss') diff --git a/nss/netgroup.c b/nss/netgroup.c index bd70768..81eb33d 100644 --- a/nss/netgroup.c +++ b/nss/netgroup.c @@ -2,7 +2,7 @@ netgroup.c - NSS lookup functions for netgroup entries Copyright (C) 2006 West Consulting - Copyright (C) 2006, 2007, 2008, 2010, 2012, 2013 Arthur de Jong + Copyright (C) 2006-2014 Arthur de Jong Copyright (C) 2010 Symas Corporation This library is free software; you can redistribute it and/or @@ -178,7 +178,8 @@ struct setnetgrent_backend { #define SETNETGRENT_ARGS(args) ((struct nss_setnetgrent_args *)(args)) #define GETNETGRENT_ARGS(args) ((struct nss_getnetgrent_args *)(args)) -/* return a netgroup that has not been traversed */ +/* return a netgroup that has not been traversed (the caller should use + free() to free it) */ static char *find_unseen_netgroup(struct setnetgrent_backend *be) { char *group; @@ -189,6 +190,7 @@ static char *find_unseen_netgroup(struct setnetgrent_backend *be) return NULL; if (!set_contains(be->seen_groups, group)) return group; + free(group); } } -- cgit v1.2.3