From e72b5e5c61aec03c46711358a31e41adf38f8403 Mon Sep 17 00:00:00 2001
From: Gary Williams <gwilliams@openldap.org>
Date: Tue, 11 May 1999 13:42:57 +0000
Subject: [PATCH] use mutex to protect connection in connection_destroy until
 task is complete

---
 servers/slapd/connection.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index 322c44d597..b7ed2d7d62 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -322,6 +322,7 @@ connection_destroy( Connection *c )
     assert( c->c_conn_state != SLAP_C_INVALID );
     assert( c->c_ops == NULL );
 
+	ldap_pvt_thread_mutex_lock( &connections_mutex );
     c->c_struct_state = SLAP_C_UNUSED;
     c->c_conn_state = SLAP_C_INVALID;
 
@@ -359,6 +360,7 @@ connection_destroy( Connection *c )
 	}
 
    	lber_pvt_sb_destroy( &c->c_sb );
+	ldap_pvt_thread_mutex_unlock( &connections_mutex );
 }
 
 int connection_state_closing( Connection *c )
-- 
GitLab