]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/delete.c
fix referral return in back-ldbm as well (same as ITS#3475)
[openldap] / servers / slapd / back-ldbm / delete.c
index 619919185588a09f67628a634bf2d075280c9245..01ae6c72755f5256b7a5000f60c5f96aaebc48ae 100644 (file)
@@ -2,7 +2,7 @@
 /* $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
@@ -49,6 +49,8 @@ ldbm_back_delete(
 
        /* FIXME : dn2entry() should return non-glue entry */
        if ( e == NULL || ( !manageDSAit && is_entry_glue( e ))) {
+               BerVarray deref = NULL;
+
                Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n",
                        op->o_req_dn.bv_val, 0, 0);
 
@@ -60,7 +62,6 @@ ldbm_back_delete(
                        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 ) {
@@ -72,7 +73,7 @@ ldbm_back_delete(
                                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);
@@ -81,6 +82,9 @@ ldbm_back_delete(
                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;
                rs->sr_matched = NULL;