From: Howard Chu Date: Mon, 30 Jan 2023 13:23:13 +0000 (+0000) Subject: ITS#9991 send_ldap_ber: make sure we're only closing our own connection X-Git-Tag: OPENLDAP_REL_ENG_2_5_14~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbb0fb93dbaaee6432a3ec77b68ef4afbfea4c86;p=thirdparty%2Fopenldap.git ITS#9991 send_ldap_ber: make sure we're only closing our own connection --- diff --git a/servers/slapd/result.c b/servers/slapd/result.c index a50f66498e..1e21cdefba 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -398,7 +398,9 @@ fail: conn->c_writing = 0; ldap_pvt_thread_mutex_unlock( &conn->c_write1_mutex ); ldap_pvt_thread_mutex_lock( &conn->c_mutex ); - connection_closing( conn, close_reason ); + /* conn may have been reused by the time we get the mutex */ + if ( op->o_connid == conn->c_connid ) + connection_closing( conn, close_reason ); ldap_pvt_thread_mutex_unlock( &conn->c_mutex ); return -1; }