]> git.sur5r.net Git - openldap/commitdiff
don't leave dangling pointers; pass entry when sending referrals
authorPierangelo Masarati <ando@openldap.org>
Mon, 30 May 2005 12:37:24 +0000 (12:37 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 30 May 2005 12:37:24 +0000 (12:37 +0000)
servers/slapd/back-ldif/ldif.c

index 1f3cdf60c87801f10bd4511bde5329c24b9761ee..a59fe576ebda46207f1847634f53095cbc394193 100644 (file)
@@ -332,11 +332,12 @@ static int r_enum_tree(enumCookie *ck, struct berval *path,
                                                ck->op->oq_search.rs_scope == LDAP_SCOPE_ONELEVEL
                                                        ? LDAP_SCOPE_BASE : LDAP_SCOPE_SUBTREE );
 
+                               ck->rs->sr_entry = e;
                                rc = send_search_reference( ck->op, ck->rs );
-
                                ber_bvarray_free( ck->rs->sr_ref );
                                ber_bvarray_free( erefs );
                                ck->rs->sr_ref = NULL;
+                               ck->rs->sr_entry = NULL;
 
                        } else if ( test_filter( ck->op, e, ck->op->ors_filter ) == LDAP_COMPARE_TRUE )
                        {
@@ -344,6 +345,7 @@ static int r_enum_tree(enumCookie *ck, struct berval *path,
                                ck->rs->sr_attrs = ck->op->ors_attrs;
                                ck->rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                rc = send_search_entry(ck->op, ck->rs);
+                               ck->rs->sr_entry = NULL;
                        }
                        fd = 1;
                        if ( rc )