From 8cb7f2f81853b3365f138cab347cbbfced298a98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= <ondra@openldap.org>
Date: Tue, 14 May 2019 12:54:58 +0100
Subject: [PATCH] ITS#8755 Do not close the default SockBuf a second time

---
 libraries/libldap/unbind.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libraries/libldap/unbind.c b/libraries/libldap/unbind.c
index 00d3df2114..b1597cb03d 100644
--- a/libraries/libldap/unbind.c
+++ b/libraries/libldap/unbind.c
@@ -131,7 +131,9 @@ ldap_ld_free(
 	}
 	LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
 
-	ber_sockbuf_free( ld->ld_sb );
+	/* Should already be closed by ldap_free_connection which knows not to free
+	 * this one */
+	ber_int_sb_destroy( ld->ld_sb );
 
 	LDAP_MUTEX_LOCK( &ld->ld_ldopts_mutex );
 
-- 
GitLab