Commit d58055b7 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

swap overlay and internal cleanup

parent d6e3c930
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment