From: Pierangelo Masarati Date: Sun, 14 May 2006 15:11:53 +0000 (+0000) Subject: cleanup resource release X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3393b15594826d29b4e8ada996cfc2009a5d29b6;p=openldap cleanup resource release --- diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 2b0d39bd25..21b49cf007 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -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 ); diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index bc0010b81f..f599039daf 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -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 );