From 8bdd54c4c1c7fac4c5ce7b7989857a64e0e58846 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 18 Sep 2014 06:49:26 +0100 Subject: [PATCH] ITS#7942 tweak previous commit Only free when cleaning up operation controls, not response controls. (This only makes a difference on search requests, which may have multiple responses with the same set of controls.) --- servers/slapd/controls.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 67d8f1608a..9b51f95034 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -565,25 +565,27 @@ void slap_free_ctrls( { int i; - if( op->o_assertion != NULL ) { - filter_free_x( op, op->o_assertion, 1 ); - op->o_assertion = NULL; - } - if( op->o_vrFilter != NULL) { - vrFilter_free( op, op->o_vrFilter ); - op->o_vrFilter = NULL; - } - if( op->o_preread_attrs != NULL ) { - op->o_tmpfree( op->o_preread_attrs, op->o_tmpmemctx ); - op->o_preread_attrs = NULL; - } - if( op->o_postread_attrs != NULL ) { - op->o_tmpfree( op->o_postread_attrs, op->o_tmpmemctx ); - op->o_postread_attrs = NULL; - } - if( op->o_pagedresults_state != NULL ) { - op->o_tmpfree( op->o_pagedresults_state, op->o_tmpmemctx ); - op->o_pagedresults_state = NULL; + if( ctrls == op->o_ctrls ) { + if( op->o_assertion != NULL ) { + filter_free_x( op, op->o_assertion, 1 ); + op->o_assertion = NULL; + } + if( op->o_vrFilter != NULL) { + vrFilter_free( op, op->o_vrFilter ); + op->o_vrFilter = NULL; + } + if( op->o_preread_attrs != NULL ) { + op->o_tmpfree( op->o_preread_attrs, op->o_tmpmemctx ); + op->o_preread_attrs = NULL; + } + if( op->o_postread_attrs != NULL ) { + op->o_tmpfree( op->o_postread_attrs, op->o_tmpmemctx ); + op->o_postread_attrs = NULL; + } + if( op->o_pagedresults_state != NULL ) { + op->o_tmpfree( op->o_pagedresults_state, op->o_tmpmemctx ); + op->o_pagedresults_state = NULL; + } } for (i=0; ctrls[i]; i++) { -- 2.39.5