From abdb6c683ff89f643e2851f86f37ba797178994e Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 26 Mar 2010 14:05:47 +0000 Subject: [PATCH] ldap_parse_result should always free result when freeit is true. --- libraries/libldap/error.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 7436888888..68463ecb75 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -281,11 +281,11 @@ ldap_parse_result( } if( lm == NULL ) { - ld->ld_errno = LDAP_NO_RESULTS_RETURNED; + errcode = ld->ld_errno = LDAP_NO_RESULTS_RETURNED; #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex ); #endif - return ld->ld_errno; + goto done; } if ( ld->ld_error ) { @@ -391,12 +391,14 @@ ldap_parse_result( } } - if ( freeit ) { - ldap_msgfree( r ); - } #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex ); #endif - return( errcode ); +done: + if ( freeit ) { + ldap_msgfree( r ); + } + + return errcode; } -- 2.39.5