]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#2187, recursively free all requests
authorHoward Chu <hyc@openldap.org>
Wed, 27 Nov 2002 03:57:36 +0000 (03:57 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 27 Nov 2002 03:57:36 +0000 (03:57 +0000)
libraries/libldap/request.c

index b1ed8dba4a343e9b69b14bce51e9ff83a1f0c78a..66c5b675241d3f6ef378f11a688c0c4c2cab03da 100644 (file)
@@ -649,15 +649,15 @@ ldap_free_request( LDAP *ld, LDAPRequest *lr )
                lr->lr_origid, lr->lr_msgid, 0 );
 #endif
 
+       /* free all referrals (child requests) */
+       while ( lr->lr_child )
+               ldap_free_request( ld, lr->lr_child );
+
        if ( lr->lr_parent != NULL ) {
                --lr->lr_parent->lr_outrefcnt;
                for ( ttmplr = &lr->lr_parent->lr_child; *ttmplr && *ttmplr != lr; ttmplr = &(*ttmplr)->lr_refnext ); 
                if ( *ttmplr == lr )  
                        *ttmplr = lr->lr_refnext;
-       } else {
-               /* free all referrals (child requests) */
-               while ( lr->lr_child )
-                       ldap_free_request( ld, lr->lr_child );
        }
        ldap_free_request_int( ld, lr );
 }