/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* FIXME: dn2entry() should return non-glue entry */
if (( e == NULL ) || ( !manageDSAit && e && is_entry_glue( e ))) {
+ BerVarray deref = NULL;
if ( matched != NULL ) {
rs->sr_matched = ch_strdup( matched->e_dn );
rs->sr_ref = is_entry_referral( matched )
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
- BerVarray deref = NULL;
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
syncinfo_t *si;
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
deref = default_referral;
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
- LDAP_SCOPE_DEFAULT );
+ LDAP_SCOPE_DEFAULT );
}
ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
+ if ( deref != default_referral ) {
+ ber_bvarray_free( deref );
+ }
free( (char *)rs->sr_matched );
rs->sr_ref = NULL;