]> git.sur5r.net Git - openldap/commitdiff
tentative fix of another issue related to ITS#3800; please review
authorPierangelo Masarati <ando@openldap.org>
Thu, 30 Jun 2005 16:49:00 +0000 (16:49 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 30 Jun 2005 16:49:00 +0000 (16:49 +0000)
libraries/libldap/abandon.c

index fa7c74efc2909974ba0f7042b2c9f227e57fd539..1b2964961e9f56283b3e291f72153a841194ead6 100644 (file)
@@ -262,6 +262,12 @@ do_abandon(
                }
        }
 
+#ifdef LDAP_R_COMPILE
+       /* ld_abandoned is actually protected by the ld_res_mutex;
+        * give up the ld_req_mutex and get the other */
+       ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
+       ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
+#endif
        i = 0;
        if ( ld->ld_abandoned != NULL ) {
                for ( ; ld->ld_abandoned[i] != -1; i++ )
@@ -276,7 +282,7 @@ do_abandon(
        if ( ld->ld_abandoned == NULL ) {
                ld->ld_abandoned = old_abandon;
                ld->ld_errno = LDAP_NO_MEMORY;
-               return( ld->ld_errno );
+               goto done;
        }
 
        ld->ld_abandoned[i] = msgid;
@@ -286,5 +292,10 @@ do_abandon(
                ld->ld_errno = LDAP_SUCCESS;
        }
 
+done:;
+#ifdef LDAP_R_COMPILE
+       ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
+       ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
+#endif
        return( ld->ld_errno );
 }