mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
ITS#12 realBase was being freed before use. The offending free()
call has been removed and additional code added to properly free realBase variable. Also fixed leaking of the matched variable.
This commit is contained in:
parent
0c11b6bb63
commit
2ffb9ae30d
@ -79,7 +79,6 @@ ldbm_back_search(
|
|||||||
switch ( deref ) {
|
switch ( deref ) {
|
||||||
case LDAP_DEREF_FINDING:
|
case LDAP_DEREF_FINDING:
|
||||||
case LDAP_DEREF_ALWAYS:
|
case LDAP_DEREF_ALWAYS:
|
||||||
free (realBase);
|
|
||||||
realBase = derefDN ( be, conn, op, base );
|
realBase = derefDN ( be, conn, op, base );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -110,6 +109,9 @@ ldbm_back_search(
|
|||||||
default:
|
default:
|
||||||
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, "",
|
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, "",
|
||||||
"Bad scope" );
|
"Bad scope" );
|
||||||
|
if( realBase != NULL) {
|
||||||
|
free( realBase );
|
||||||
|
}
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,9 +121,16 @@ ldbm_back_search(
|
|||||||
if ( matched != NULL ) {
|
if ( matched != NULL ) {
|
||||||
free( matched );
|
free( matched );
|
||||||
}
|
}
|
||||||
|
if( realBase != NULL) {
|
||||||
|
free( realBase );
|
||||||
|
}
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( matched != NULL ) {
|
||||||
|
free( matched );
|
||||||
|
}
|
||||||
|
|
||||||
rmaxsize = 0;
|
rmaxsize = 0;
|
||||||
nrefs = 0;
|
nrefs = 0;
|
||||||
rbuf = rcur = NULL;
|
rbuf = rcur = NULL;
|
||||||
@ -136,6 +145,9 @@ ldbm_back_search(
|
|||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
idl_free( candidates );
|
idl_free( candidates );
|
||||||
free( rbuf );
|
free( rbuf );
|
||||||
|
if( realBase != NULL) {
|
||||||
|
free( realBase );
|
||||||
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock( &op->o_abandonmutex );
|
pthread_mutex_unlock( &op->o_abandonmutex );
|
||||||
@ -150,6 +162,9 @@ ldbm_back_search(
|
|||||||
NULL, nentries );
|
NULL, nentries );
|
||||||
idl_free( candidates );
|
idl_free( candidates );
|
||||||
free( rbuf );
|
free( rbuf );
|
||||||
|
if( realBase != NULL) {
|
||||||
|
free( realBase );
|
||||||
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock( ¤ttime_mutex );
|
pthread_mutex_unlock( ¤ttime_mutex );
|
||||||
@ -274,6 +289,10 @@ ldbm_back_search(
|
|||||||
}
|
}
|
||||||
free( rbuf );
|
free( rbuf );
|
||||||
|
|
||||||
|
if( realBase != NULL) {
|
||||||
|
free( realBase );
|
||||||
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user