]> git.sur5r.net Git - openldap/commitdiff
swap overlay and internal cleanup
authorPierangelo Masarati <ando@openldap.org>
Tue, 13 Jul 2004 22:00:28 +0000 (22:00 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 13 Jul 2004 22:00:28 +0000 (22:00 +0000)
servers/slapd/result.c

index a15737129c51ce57b63f17a3746913926d1016f6..74238529414f6ed4c9f7b8c1919e2d5580dcdb1c 100644 (file)
@@ -471,12 +471,24 @@ send_ldap_response(
        num_pdu_sent++;
        ldap_pvt_thread_mutex_unlock( &num_sent_mutex );
 
-cleanup:
+cleanup:;
        /* Tell caller that we did this for real, as opposed to being
         * overridden by a callback
         */
        rc = SLAP_CB_CONTINUE;
 
+clean2:;
+       if ( op->o_callback ) {
+               slap_callback *sc = op->o_callback;
+               for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
+                       if ( op->o_callback->sc_cleanup ) {
+                               (void)op->o_callback->sc_cleanup( op, rs );
+                       }
+               }
+               op->o_callback = sc;
+       }
+
+
        if ( rs->sr_matched && rs->sr_flags & REP_MATCHED_MUSTBEFREED ) {
                free( (char *)rs->sr_matched );
                rs->sr_matched = NULL;
@@ -487,17 +499,6 @@ cleanup:
                rs->sr_ref = NULL;
        }
 
-clean2:
-       if (op->o_callback) {
-               slap_callback *sc = op->o_callback;
-               for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
-                       if ( op->o_callback->sc_cleanup ) {
-                               op->o_callback->sc_cleanup( op, rs );
-                       }
-               }
-               op->o_callback = sc;
-       }
-
        return rc;
 }
 
@@ -1340,6 +1341,20 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
        rc = 0;
 
 error_return:;
+       if ( e_flags ) {
+               slap_sl_free( e_flags, op->o_tmpmemctx );
+       }
+
+       if ( op->o_callback ) {
+               slap_callback *sc = op->o_callback;
+               for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
+                       if ( op->o_callback->sc_cleanup ) {
+                               (void)op->o_callback->sc_cleanup( op, rs );
+                       }
+               }
+               op->o_callback = sc;
+       }
+
        /* FIXME: I think rs->sr_type should be explicitly set to
         * REP_SEARCH here. That's what it was when we entered this
         * function. send_ldap_error may have changed it, but we
@@ -1348,24 +1363,13 @@ error_return:;
         */
        if ( op->o_tag == LDAP_REQ_SEARCH && rs->sr_type == REP_SEARCH 
                && rs->sr_entry 
-               && (rs->sr_flags & REP_ENTRY_MUSTBEFREED) ) 
+               && ( rs->sr_flags & REP_ENTRY_MUSTBEFREED ) ) 
        {
                entry_free( rs->sr_entry );
                rs->sr_entry = NULL;
                rs->sr_flags &= ~REP_ENTRY_MUSTBEFREED;
        }
 
-       if ( e_flags ) slap_sl_free( e_flags, op->o_tmpmemctx );
-
-       if (op->o_callback) {
-               slap_callback *sc = op->o_callback;
-               for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
-                       if ( op->o_callback->sc_cleanup ) {
-                               op->o_callback->sc_cleanup( op, rs );
-                       }
-               }
-               op->o_callback = sc;
-       }
        return( rc );
 }
 
@@ -1545,15 +1549,16 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
 #endif
 
 rel:
-       if (op->o_callback) {
+       if ( op->o_callback ) {
                slap_callback *sc = op->o_callback;
                for ( ; op->o_callback; op->o_callback = op->o_callback->sc_next ) {
                        if ( op->o_callback->sc_cleanup ) {
-                               op->o_callback->sc_cleanup( op, rs );
+                               (void)op->o_callback->sc_cleanup( op, rs );
                        }
                }
                op->o_callback = sc;
        }
+
        return rc;
 }