From 7701c82b685d31271e116600da06e133bf7086b3 Mon Sep 17 00:00:00 2001
From: Pierangelo Masarati <ando@openldap.org>
Date: Wed, 17 Jan 2007 22:22:00 +0000
Subject: [PATCH] fix ITS#4802

---
 servers/slapd/overlays/refint.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/servers/slapd/overlays/refint.c b/servers/slapd/overlays/refint.c
index 0a6d093775..0a7c1aeb09 100644
--- a/servers/slapd/overlays/refint.c
+++ b/servers/slapd/overlays/refint.c
@@ -320,12 +320,14 @@ refint_close(
 		ij = ii->next;
 		ch_free(ii);
 	}
+	id->attrs = NULL;
 
-	ch_free(id->dn.bv_val);
-	ch_free(id->nothing.bv_val);
-	ch_free(id->nnothing.bv_val);
-
-	memset( id, 0, sizeof(*id));
+	ch_free( id->dn.bv_val );
+	BER_BVZERO( &id->dn );
+	ch_free( id->nothing.bv_val );
+	BER_BVZERO( &id->nothing );
+	ch_free( id->nnothing.bv_val );
+	BER_BVZERO( &id->nnothing );
 
 	return(0);
 }