]> git.sur5r.net Git - openldap/commitdiff
ITS#7636 slapi: don't free filterstr if filter didn't change
authorHoward Chu <hyc@openldap.org>
Wed, 10 Jul 2013 19:56:04 +0000 (12:56 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 29 Jul 2013 19:32:21 +0000 (12:32 -0700)
servers/slapd/slapi/slapi_overlay.c

index 0db4ce2a0498cdde51cf96b7412a1c68e0caf003..ad23153e22ce56376d4f95ecf7681b36b0e16c94 100644 (file)
@@ -296,6 +296,7 @@ static int
 slapi_op_search_callback( Operation *op, SlapReply *rs, int prc )
 {
        Slapi_PBlock            *pb = SLAPI_OPERATION_PBLOCK( op );
+       Filter *f = op->ors_filter;
 
        /* check preoperation result code */
        if ( prc < 0 ) {
@@ -310,8 +311,10 @@ slapi_op_search_callback( Operation *op, SlapReply *rs, int prc )
                 * The plugin can set the SLAPI_SEARCH_FILTER.
                 * SLAPI_SEARCH_STRFILER is not normative.
                 */
-               op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
-               filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
+               if (f != op->ors_filter) {
+                       op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
+                       filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
+               }
        }
 
        return LDAP_SUCCESS;