]> git.sur5r.net Git - openldap/commitdiff
(yet) another potential concurrency issue
authorPierangelo Masarati <ando@openldap.org>
Sat, 23 Jul 2005 22:04:04 +0000 (22:04 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 23 Jul 2005 22:04:04 +0000 (22:04 +0000)
libraries/libldap/request.c
libraries/libldap/result.c

index f359af228cc75bb8c80dac703513a1c10bfdd250..f48ca43ff161e6f5c2f9b4416d25365eecf4b04d 100644 (file)
@@ -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 );
index ca2c41dab68803210edb394865fd3e7d8a6b7d37..8963ca61fc25b4fe94896ba9184c80f5a0a6f15b 100644 (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 );
+#ifdef LDAP_R_COMPILE
+                               ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+#endif
                        }
 
                        if ( lc != NULL ) {