From: Quanah Gibson-Mount Date: Thu, 15 Apr 2010 22:03:50 +0000 (+0000) Subject: ldap_parse_result should always free result when freeit is true. X-Git-Tag: OPENLDAP_REL_ENG_2_4_22~52 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5a28e885eee7062f1a7d3e49135425e7b1c2b684;p=openldap ldap_parse_result should always free result when freeit is true. --- diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 9098aa5afe..b0d5d3cda1 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; }