andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0081-Ticket-47428-Memory-leak-in-389-ds-base-1.2.11.15.patch

dc8c34
From ef6e05286dbd4df3bc20cee51b1769496612a7af Mon Sep 17 00:00:00 2001
dc8c34
From: Matthew Via <​matthew.via@mailtrust.com>
dc8c34
Date: Wed, 10 Jul 2013 11:30:57 -0600
dc8c34
Subject: [PATCH 81/99] Ticket #47428 - Memory leak in 389-ds-base 1.2.11.15
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47428
dc8c34
Reviewed by: rmeggins
dc8c34
Branch: 389-ds-base-1.2.11
dc8c34
Fix Description: Call ber_sockbuf_remove_io to remove our openldap io layer
dc8c34
from the connection c_sb and free the data associated with it.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit df93b03da12c22d18a4153105f687671e52efdd5)
dc8c34
(cherry picked from commit ed26da0722a23a50fb286e8bc57ec4fea8dde4a2)
dc8c34
(cherry picked from commit b18ee0b41fbcc901ed2a9b5c0431708e452a40c6)
dc8c34
(cherry picked from commit 6e0a8efb16a1651387623ce997c021f0460d2788)
dc8c34
---
dc8c34
 ldap/servers/slapd/connection.c | 1 +
dc8c34
 ldap/servers/slapd/daemon.c     | 7 +++++++
dc8c34
 ldap/servers/slapd/proto-slap.h | 1 +
dc8c34
 3 files changed, 9 insertions(+)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
dc8c34
index 1d1adac..914a2d3 100644
dc8c34
--- a/ldap/servers/slapd/connection.c
dc8c34
+++ b/ldap/servers/slapd/connection.c
dc8c34
@@ -203,6 +203,7 @@ connection_cleanup(Connection *conn)
dc8c34
 	/* destroy any sasl context */
dc8c34
 	sasl_dispose((sasl_conn_t**)&conn->c_sasl_conn);
dc8c34
 	/* PAGED_RESULTS */
dc8c34
+	handle_closed_connection(conn);  /* Clean up sockbufs */
dc8c34
 	pagedresults_cleanup(conn, 0 /* do not need to lock inside */);
dc8c34
 
dc8c34
 	/* free the connection socket buffer */
dc8c34
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
dc8c34
index c67067b..8f147f1 100644
dc8c34
--- a/ldap/servers/slapd/daemon.c
dc8c34
+++ b/ldap/servers/slapd/daemon.c
dc8c34
@@ -2590,6 +2590,13 @@ bail:
dc8c34
 #endif /* ENABLE_AUTOBIND */
dc8c34
 #endif /* ENABLE_LDAPI */
dc8c34
 
dc8c34
+void
dc8c34
+handle_closed_connection(Connection *conn)
dc8c34
+{
dc8c34
+	ber_sockbuf_remove_io(conn->c_sb, &openldap_sockbuf_io,
dc8c34
+		LBER_SBIOD_LEVEL_PROVIDER);
dc8c34
+}
dc8c34
+
dc8c34
 /* NOTE: this routine is not reentrant */
dc8c34
 static int
dc8c34
 handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local)
dc8c34
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
dc8c34
index a15c0cc..d4c9ab6 100644
dc8c34
--- a/ldap/servers/slapd/proto-slap.h
dc8c34
+++ b/ldap/servers/slapd/proto-slap.h
dc8c34
@@ -1379,6 +1379,7 @@ int sasl_io_setup(Connection *c);
dc8c34
 /*
dc8c34
  * daemon.c
dc8c34
  */
dc8c34
+void handle_closed_connection(Connection *);
dc8c34
 #ifndef LINUX
dc8c34
 void slapd_do_nothing(int);
dc8c34
 #endif
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34