mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
ITS#7967 fix abandon regression
From ITS#7712, avoid double-free of request
This commit is contained in:
parent
b0e46fb9f9
commit
b36bd703d7
@ -278,23 +278,29 @@ start_again:;
|
||||
}
|
||||
|
||||
if ( lr != NULL ) {
|
||||
LDAPConn *lc;
|
||||
int freeconn = 0;
|
||||
if ( sendabandon || lr->lr_status == LDAP_REQST_WRITING ) {
|
||||
/* release ld_req_mutex while grabbing ld_conn_mutex to
|
||||
* prevent deadlock.
|
||||
*/
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
ldap_free_connection( ld, lr->lr_conn, 0, 1 );
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
freeconn = 1;
|
||||
lc = lr->lr_conn;
|
||||
}
|
||||
|
||||
if ( origid == msgid ) {
|
||||
ldap_free_request( ld, lr );
|
||||
|
||||
} else {
|
||||
lr->lr_abandoned = 1;
|
||||
}
|
||||
|
||||
if ( freeconn ) {
|
||||
/* release ld_req_mutex while grabbing ld_conn_mutex to
|
||||
* prevent deadlock.
|
||||
*/
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
ldap_free_connection( ld, lc, 0, 1 );
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
}
|
||||
}
|
||||
|
||||
LDAP_MUTEX_LOCK( &ld->ld_abandon_mutex );
|
||||
|
Loading…
Reference in New Issue
Block a user