cleanup resource release

This commit is contained in:
Pierangelo Masarati 2006-05-14 15:11:53 +00:00
parent 092aade428
commit 3393b15594
2 changed files with 12 additions and 9 deletions

View file

@ -525,7 +525,7 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
if ( *lcp == NULL ) {
*lcp = (ldapconn_t *)ch_calloc( 1, sizeof( ldapconn_t ) );
(*lcp)->lc_flags= li->li_flags;
(*lcp)->lc_flags = li->li_flags;
}
(*lcp)->lc_ld = ld;
(*lcp)->lc_refcnt = 1;
@ -736,6 +736,7 @@ retry_lock:
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: %s.\n", buf, 0, 0 );
}
}
#ifdef HAVE_TLS
@ -981,6 +982,7 @@ retry:;
}
}
lc->lc_binding--;
ldap_back_freeconn( op, lc, dolock );
rs->sr_err = slap_map_api2result( rs );

View file

@ -93,8 +93,6 @@ meta_search_dobind_init(
return META_SEARCH_CANDIDATE;
}
assert( msc->msc_ld != NULL );
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
if ( LDAP_BACK_CONN_ISBOUND( msc ) || LDAP_BACK_CONN_ISANON( msc ) ) {
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
@ -133,6 +131,8 @@ meta_search_dobind_init(
}
retry:;
assert( msc->msc_ld != NULL );
rc = ldap_sasl_bind( msc->msc_ld, binddn, LDAP_SASL_SIMPLE, &cred,
NULL, NULL, &candidates[ candidate ].sr_msgid );
switch ( rc ) {
@ -192,7 +192,9 @@ meta_search_dobind_result(
meta_search_candidate_t retcode = META_SEARCH_NOT_CANDIDATE;
int rc;
rc = ldap_parse_result( msc->msc_ld, res,
assert( msc->msc_ld != NULL );
rc = ldap_parse_result( msc->msc_ld, res,
&candidates[ candidate ].sr_err,
NULL, NULL, NULL, NULL, 1 );
if ( rc == LDAP_SUCCESS ) {
@ -250,7 +252,8 @@ meta_back_search_start(
/* should we check return values? */
if ( op->ors_deref != -1 ) {
ldap_set_option( msc->msc_ld, LDAP_OPT_DEREF,
assert( msc->msc_ld != NULL );
(void)ldap_set_option( msc->msc_ld, LDAP_OPT_DEREF,
( void * )&op->ors_deref );
}
@ -1229,11 +1232,9 @@ finish:;
continue;
}
if ( mc ) {
if ( mc && candidates[ i ].sr_msgid >= 0 ) {
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
if ( LDAP_BACK_CONN_BINDING( &mc->mc_conns[ i ] )
&& candidates[ i ].sr_msgid != META_MSGID_NEED_BIND )
{
if ( LDAP_BACK_CONN_BINDING( &mc->mc_conns[ i ] ) ) {
LDAP_BACK_CONN_BINDING_CLEAR( &mc->mc_conns[ i ] );
}
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );