From: Pierangelo Masarati Date: Sat, 23 Jul 2005 22:04:04 +0000 (+0000) Subject: (yet) another potential concurrency issue X-Git-Tag: OPENLDAP_AC_BP~222 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7fade0d585b630b66b8a143f4d8e9b3418badfad;p=openldap (yet) another potential concurrency issue --- diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index f359af228c..f48ca43ff1 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -135,7 +135,7 @@ ldap_send_initial_request( ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); #endif rc = ldap_send_server_request( ld, ber, msgid, NULL, - servers, NULL, NULL ); + servers, NULL, NULL ); #ifdef LDAP_R_COMPILE ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); #endif @@ -612,8 +612,10 @@ void ldap_free_request_int( LDAP *ld, LDAPRequest *lr ) { if ( lr->lr_prev == NULL ) { + /* free'ing the first request? */ assert( ld->ld_requests == lr ); ld->ld_requests = lr->lr_next; + } else { lr->lr_prev->lr_next = lr->lr_next; } @@ -1033,12 +1035,12 @@ ldap_chase_referrals( LDAP *ld, rinfo.ri_msgid = origreq->lr_origid; #ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); + ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex ); #endif rc = ldap_send_server_request( ld, ber, id, - lr, srv, NULL, &rinfo ); + lr, srv, NULL, &rinfo ); #ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); + ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); #endif LDAP_FREE( rinfo.ri_url ); diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index ca2c41dab6..8963ca61fc 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -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 ); +#ifdef LDAP_R_COMPILE + ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex ); +#endif } if ( lc != NULL ) {