From a1da2929897bd1b3889b436ca061f921c10c43ab Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Sun, 15 Sep 2002 22:42:50 +0000
Subject: [PATCH] Wrap csn filter frees with sync mode check.

---
 servers/slapd/back-bdb/search.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c
index 6e7548b857..91db533895 100644
--- a/servers/slapd/back-bdb/search.c
+++ b/servers/slapd/back-bdb/search.c
@@ -794,6 +794,7 @@ loop_continue:
 
 		ldap_pvt_thread_yield();
 	}
+
 #ifdef LDAP_CLIENT_UPDATE
 	if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
 		int ret;
@@ -866,12 +867,14 @@ done:
 	}
 
 #ifdef LDAP_CLIENT_UDATE
-	if ( csnfeq.f_ava != NULL && csnfeq.f_av_value.bv_val != NULL ) {
-		ch_free( csnfeq.f_av_value.bv_val );
-	}
+	if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
+		if ( csnfeq.f_ava != NULL && csnfeq.f_av_value.bv_val != NULL ) {
+			ch_free( csnfeq.f_av_value.bv_val );
+		}
 	
-	if ( csnfge.f_ava != NULL && csnfge.f_av_value.bv_val != NULL ) {
-		ch_free( csnfge.f_av_value.bv_val );
+		if ( csnfge.f_ava != NULL && csnfge.f_av_value.bv_val != NULL ) {
+			ch_free( csnfge.f_av_value.bv_val );
+		}
 	}
 #endif /* LDAP_CLIENT_UPDATE */
 
-- 
GitLab