From 1f57c00ce4cc13e86b341e18a1630cd506be102b Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Thu, 25 Oct 2007 21:19:46 +0000 Subject: 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 --- nslcd/ldap-nss.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nslcd/ldap-nss.c') 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) { -- cgit v1.2.3