Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd/ldap-nss.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2007-10-25 23:19:46 +0200
committerArthur de Jong <arthur@arthurdejong.org>2007-10-25 23:19:46 +0200
commit1f57c00ce4cc13e86b341e18a1630cd506be102b (patch)
treeadbaf124e4351a08fb8993a4123522f70ae293c4 /nslcd/ldap-nss.c
parent22a7e5edae37bc3b5064e6cc895e425775a24bbc (diff)
clean up any messages after abandoning the search because that returns a new message (fix memory leak)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@454 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/ldap-nss.c')
-rw-r--r--nslcd/ldap-nss.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/nslcd/ldap-nss.c b/nslcd/ldap-nss.c
index 17b91a8..63c70b0 100644
--- a/nslcd/ldap-nss.c
+++ b/nslcd/ldap-nss.c
@@ -704,18 +704,18 @@ void _nss_ldap_ent_context_cleanup(struct ent_context *context)
{
if (context==NULL)
return;
- /* free read messages */
- if (context->ec_res!=NULL)
- {
- ldap_msgfree(context->ec_res);
- context->ec_res=NULL;
- }
/* abandon the search if there were more results to fetch */
if ((context->ec_msgid>-1)&&(do_result_async(context)==NSS_STATUS_SUCCESS))
{
ldap_abandon(context->session->ls_conn,context->ec_msgid);
context->ec_msgid=-1;
}
+ /* free read messages */
+ if (context->ec_res!=NULL)
+ {
+ ldap_msgfree(context->ec_res);
+ context->ec_res=NULL;
+ }
/* clean up cookie */
if (context->ec_cookie!=NULL)
{