From: Pierangelo Masarati Date: Wed, 3 May 2006 18:54:04 +0000 (+0000) Subject: don't muck with freed memory (spotted by valgrind) X-Git-Tag: OPENLDAP_REL_ENG_2_4_1ALPHA~2^2~85 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=45b378c753d6ec8e86de87e088ff94608511795b;p=openldap don't muck with freed memory (spotted by valgrind) --- diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index 1993e4aeb1..cc8fea04b8 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -721,9 +721,12 @@ retry:; if ( meta_back_retry( op, rs, &mc, i, sendok ) ) { goto retry; } - ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex ); - LDAP_BACK_CONN_BINDING_CLEAR( msc ); - ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex ); + + if ( mc != NULL ) { + ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex ); + LDAP_BACK_CONN_BINDING_CLEAR( msc ); + ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex ); + } return 0; }