From: Kurt Zeilenga Date: Fri, 26 Mar 2010 14:05:47 +0000 (+0000) Subject: ldap_parse_result should always free result when freeit is true. X-Git-Tag: MIGRATION_CVS2GIT~662 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=abdb6c683ff89f643e2851f86f37ba797178994e;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 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; }