url_done:;
if ( op2.ors_filter && op2.ors_filter != slap_filter_objectClass_pres ) {
- filter_free_x( cp->asc_op, op2.ors_filter );
+ filter_free_x( cp->asc_op, op2.ors_filter, 1 );
}
if ( !BER_BVISNULL( &op2.o_req_ndn ) ) {
slap_sl_free( op2.o_req_ndn.bv_val, cp->asc_op->o_tmpmemctx );
cleanup:;
if ( op->ors_filter != NULL ) {
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
}
if ( !BER_BVISNULL( &op->ors_filterstr ) ) {
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
{
rc = 0;
}
- filter_free_x( op, filter );
+ filter_free_x( op, filter, 1 );
}
loopit:
ldap_free_urldesc( ludp );
send_ldap_result( op, rs );
}
if( op->o_assertion != NULL ) {
- filter_free_x( op, op->o_assertion );
+ filter_free_x( op, op->o_assertion, 1 );
}
return rs->sr_err;
}
}
void
-filter_free_x( Operation *op, Filter *f )
+filter_free_x( Operation *op, Filter *f, int freeme )
{
Filter *p, *next;
case LDAP_FILTER_NOT:
for ( p = f->f_list; p != NULL; p = next ) {
next = p->f_next;
- filter_free_x( op, p );
+ filter_free_x( op, p, 1 );
}
break;
break;
}
- op->o_tmpfree( f, op->o_tmpmemctx );
+ if ( freeme ) {
+ op->o_tmpfree( f, op->o_tmpmemctx );
+ }
}
void
op.o_hdr = &ohdr;
op.o_tmpmemctx = slap_sl_context( f );
op.o_tmpmfuncs = &slap_sl_mfuncs;
- filter_free_x( &op, f );
+ filter_free_x( &op, f, 1 );
}
void
done_search:;
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
rc = rs.sr_err;
switch ( rs.sr_err ) {
done_search:;
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
rc = rs.sr_err;
switch ( rs.sr_err ) {
slap_op_groups_free( &o );
}
if ( o.ors_filter ) {
- filter_free_x( &o, o.ors_filter );
+ filter_free_x( &o, o.ors_filter, 1 );
}
if ( o.ors_attrs && o.ors_attrs != rs->sr_attrs
&& o.ors_attrs != slap_anlist_no_attrs )
rc = op2.o_bd->be_search( &op2, rs );
op->o_abandon = op2.o_abandon;
- filter_free_x( &op2, op2.ors_filter );
+ filter_free_x( &op2, op2.ors_filter, 1 );
ber_memfree_x( op2.ors_filterstr.bv_val, op2.o_tmpmemctx );
if ( rdc.rdc_flags == SLAP_CB_CONTINUE ) {
break;
case LDAP_REQ_SEARCH:
ch_free( ros->mapped_attrs );
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
ch_free( op->ors_filterstr.bv_val );
op->ors_attrs = ros->ors_attrs;
op->ors_filter = ros->ors_filter;
}
if ( f != NULL ) {
- filter_free_x( op, f );
+ filter_free_x( op, f, 1 );
}
if ( !BER_BVISNULL( &fstr ) ) {
return LDAP_OTHER;
}
+ if ( f->f_choice & SLAPD_FILTER_UNDEFINED ) {
+ goto computed;
+ }
+
switch ( f->f_choice & SLAPD_FILTER_MASK ) {
case LDAP_FILTER_EQUALITY:
ad = f->f_av_desc;
case -1:
computed:;
- filter_free_x( op, f );
+ filter_free_x( op, f, 0 );
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
/* fallthru */
nop->o_bd = on->on_info->oi_origdb;
rc = nop->o_bd->be_search(nop, &nrs);
- filter_free_x(nop, nop->ors_filter);
+ filter_free_x(nop, nop->ors_filter, 1);
op->o_tmpfree( key->bv_val, op->o_tmpmemctx );
if(rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT) {
const char **text ));
LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
-LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
+LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f, int freeme ));
LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Operation *op, Filter *f, struct berval *bv ));
LDAP_SLAPD_F (Filter *) filter_dup LDAP_P(( Filter *f, void *memctx ));
}
rc = REWRITE_ERR;
}
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
return rc;
}
done:
if( rc != LDAP_SUCCESS ) {
- if( *filter ) filter_free_x( op, *filter );
+ if( *filter ) filter_free_x( op, *filter, 1 );
BER_BVZERO( base );
BER_BVZERO( fstr );
} else {
CONCLUDED:
if( !BER_BVISNULL( &op.o_req_dn ) ) slap_sl_free( op.o_req_dn.bv_val, opx->o_tmpmemctx );
if( !BER_BVISNULL( &op.o_req_ndn ) ) slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
- if( op.ors_filter ) filter_free_x( opx, op.ors_filter );
+ if( op.ors_filter ) filter_free_x( opx, op.ors_filter, 1 );
if( !BER_BVISNULL( &op.ors_filterstr ) ) ch_free( op.ors_filterstr.bv_val );
Debug( LDAP_DEBUG_TRACE,
slap_sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
}
if( op.ors_filter ) {
- filter_free_x( opx, op.ors_filter );
+ filter_free_x( opx, op.ors_filter, 1 );
}
if( !BER_BVISNULL( &op.ors_filterstr ) ) {
ch_free( op.ors_filterstr.bv_val );
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
}
if ( op->ors_filter != NULL) {
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
}
if ( op->ors_attrs != NULL ) {
op->o_tmpfree( op->ors_attrs, op->o_tmpmemctx );
op->o_tmpfree( cf, op->o_tmpmemctx );
op->ors_filter = of;
}
- if ( op->ors_filter ) filter_free_x( op, op->ors_filter );
+ if ( op->ors_filter ) filter_free_x( op, op->ors_filter, 1 );
}