From 11e8c186bf96571398e60df276ac1f62712b99d9 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Thu, 31 May 2007 15:49:45 +0000 Subject: [PATCH] ITS#4991 restore save_attrs when a request is finished to let do_search() cleanup correctly --- servers/slapd/overlays/pcache.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 93fac07d83..17d5afd15c 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1251,6 +1251,18 @@ cache_entries( return return_val; } +static int +pcache_op_cleanup( Operation *op, SlapReply *rs ) { + slap_callback *cb = op->o_callback; + struct search_info *si = cb->sc_private; + if ( si->save_attrs != NULL ) { + rs->sr_attrs = si->save_attrs; + op->ors_attrs = si->save_attrs; + } + op->o_callback = op->o_callback->sc_next; + op->o_tmpfree( cb, op->o_tmpmemctx ); +} + static int pcache_response( Operation *op, @@ -1264,7 +1276,6 @@ pcache_response( if ( si->save_attrs != NULL ) { rs->sr_attrs = si->save_attrs; op->ors_attrs = si->save_attrs; - si->save_attrs = NULL; } if ( rs->sr_type == REP_SEARCH ) { @@ -1332,8 +1343,7 @@ pcache_response( filter_free( si->query.filter ); } - /* free self */ - op->o_callback->sc_cleanup = slap_freeself_cb; + op->o_callback->sc_cleanup = pcache_op_cleanup; } return SLAP_CB_CONTINUE; } -- 2.39.5