Prechádzať zdrojové kódy

Ticket #47428 - Memory leak in 389-ds-base 1.2.11.15

https://fedorahosted.org/389/ticket/47428
Reviewed by: rmeggins
Branch: master
Fix Description: Call ber_sockbuf_remove_io to remove our openldap io layer
from the connection c_sb and free the data associated with it.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Matthew Via 12 rokov pred
rodič
commit
df93b03da1

+ 1 - 0
ldap/servers/slapd/connection.c

@@ -263,6 +263,7 @@ connection_cleanup(Connection *conn)
 	/* destroy any sasl context */
 	sasl_dispose((sasl_conn_t**)&conn->c_sasl_conn);
 	/* PAGED_RESULTS */
+	handle_closed_connection(conn);  /* Clean up sockbufs */
 	pagedresults_cleanup(conn, 0 /* do not need to lock inside */);
 
 	/* free the connection socket buffer */

+ 7 - 0
ldap/servers/slapd/daemon.c

@@ -2593,6 +2593,13 @@ bail:
 #endif /* ENABLE_AUTOBIND */
 #endif /* ENABLE_LDAPI */
 
+void
+handle_closed_connection(Connection *conn)
+{
+	ber_sockbuf_remove_io(conn->c_sb, &openldap_sockbuf_io,
+		LBER_SBIOD_LEVEL_PROVIDER);
+}
+
 /* NOTE: this routine is not reentrant */
 static int
 handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local)

+ 1 - 0
ldap/servers/slapd/proto-slap.h

@@ -1413,6 +1413,7 @@ int sasl_io_setup(Connection *c);
 /*
  * daemon.c
  */
+void handle_closed_connection(Connection *);
 #ifndef LINUX
 void slapd_do_nothing(int);
 #endif