From 45b378c753d6ec8e86de87e088ff94608511795b Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 3 May 2006 18:54:04 +0000 Subject: [PATCH] don't muck with freed memory (spotted by valgrind) --- servers/slapd/back-meta/bind.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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; } -- 2.39.5