static int
ldap_back_munge_filter(
Operation *op,
- struct berval *filter )
+ struct berval *filter,
+ int *freeit )
{
ldapinfo_t *li = (ldapinfo_t *) op->o_bd->be_private;
AC_MEMCPY( filter->bv_val, op->ors_filterstr.bv_val,
op->ors_filterstr.bv_len + 1 );
+ *freeit = 1;
} else {
filter->bv_val = op->o_tmprealloc( filter->bv_val,
filter->bv_len + 1, op->o_tmpmemctx );
filter = BER_BVNULL;
int i;
char **attrs = NULL;
- int freetext = 0;
+ int freetext = 0, freefilter = 0;
int do_retry = 1, dont_retry = 0;
LDAPControl **ctrls = NULL;
char **references = NULL;
goto finish;
case LDAP_FILTER_ERROR:
- if (ldap_back_munge_filter( op, &filter ) > 0 ) {
+ if (ldap_back_munge_filter( op, &filter, &freefilter ) > 0 ) {
goto retry;
}
ldap_back_quarantine( op, rs );
}
- if ( filter.bv_val != op->ors_filterstr.bv_val ) {
+ if ( freefilter ) {
op->o_tmpfree( filter.bv_val, op->o_tmpmemctx );
}