Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2014-01-05 14:47:30 +0100
committerArthur de Jong <arthur@arthurdejong.org>2014-01-05 15:04:46 +0100
commit8e74848cff12ea9902c59081515d46fc51d6f545 (patch)
treea6700006b538b09a6944b8d5a53a760711e0bfe5 /nss
parent328894237b24e50b8d39f1fe85f9fa7e2d37e5de (diff)
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.
Diffstat (limited to 'nss')
-rw-r--r--nss/netgroup.c6
1 files changed, 4 insertions, 2 deletions
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);
}
}