From 8d4281d84312140ef8b65d3c228298725fb62060 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Thu, 16 Dec 2004 13:48:36 +0000
Subject: [PATCH] ITS#3443 fix shutdown test

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

diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index f8b7e55fc5..8e15a43934 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -912,11 +912,13 @@ do_syncrepl(
 		return NULL;
 	}
 
-	if ( slapd_shutdown && si->si_ld ) {
-		ldap_get_option( si->si_ld, LDAP_OPT_DESC, &s );
-		connection_client_stop( s );
-		ldap_unbind( si->si_ld );
-		si->si_ld = NULL;
+	if ( slapd_shutdown ) {
+		if ( si->si_ld ) {
+			ldap_get_option( si->si_ld, LDAP_OPT_DESC, &s );
+			connection_client_stop( s );
+			ldap_unbind( si->si_ld );
+			si->si_ld = NULL;
+		}
 		return NULL;
 	}
 
-- 
GitLab