]> git.sur5r.net Git - openldap/commitdiff
don't muck with freed memory (spotted by valgrind)
authorPierangelo Masarati <ando@openldap.org>
Wed, 3 May 2006 18:54:04 +0000 (18:54 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 3 May 2006 18:54:04 +0000 (18:54 +0000)
servers/slapd/back-meta/bind.c

index 1993e4aeb148c271017667f487315b5df6be25d8..cc8fea04b81505c2e24edf6ec19c655cfb359bff 100644 (file)
@@ -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;
                        }