(yet) another potential concurrency issue

This commit is contained in:
Pierangelo Masarati 2005-07-23 22:04:04 +00:00
parent 3e84f692aa
commit 7fade0d585
2 changed files with 12 additions and 4 deletions

View File

@ -135,7 +135,7 @@ ldap_send_initial_request(
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif #endif
rc = ldap_send_server_request( ld, ber, msgid, NULL, rc = ldap_send_server_request( ld, ber, msgid, NULL,
servers, NULL, NULL ); servers, NULL, NULL );
#ifdef LDAP_R_COMPILE #ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif #endif
@ -612,8 +612,10 @@ void
ldap_free_request_int( LDAP *ld, LDAPRequest *lr ) ldap_free_request_int( LDAP *ld, LDAPRequest *lr )
{ {
if ( lr->lr_prev == NULL ) { if ( lr->lr_prev == NULL ) {
/* free'ing the first request? */
assert( ld->ld_requests == lr ); assert( ld->ld_requests == lr );
ld->ld_requests = lr->lr_next; ld->ld_requests = lr->lr_next;
} else { } else {
lr->lr_prev->lr_next = lr->lr_next; lr->lr_prev->lr_next = lr->lr_next;
} }
@ -1033,12 +1035,12 @@ ldap_chase_referrals( LDAP *ld,
rinfo.ri_msgid = origreq->lr_origid; rinfo.ri_msgid = origreq->lr_origid;
#ifdef LDAP_R_COMPILE #ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif #endif
rc = ldap_send_server_request( ld, ber, id, rc = ldap_send_server_request( ld, ber, id,
lr, srv, NULL, &rinfo ); lr, srv, NULL, &rinfo );
#ifdef LDAP_R_COMPILE #ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif #endif
LDAP_FREE( rinfo.ri_url ); LDAP_FREE( rinfo.ri_url );

View File

@ -712,7 +712,13 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
} }
} }
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
ldap_free_request( ld, lr ); ldap_free_request( ld, lr );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
#endif
} }
if ( lc != NULL ) { if ( lc != NULL ) {