changeset 10285:8e0daec5f995

6851301 libldap5 leaks ~64K per SASL connection
author Milan Jurik <Milan.Jurik@Sun.COM>
date Sun, 09 Aug 2009 09:31:03 +0100
parents f12571ecd37e
children 74dccb2b9732
files usr/src/lib/libldap5/sources/ldap/common/sasl.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libldap5/sources/ldap/common/sasl.c	Sun Aug 09 09:20:12 2009 +0100
+++ b/usr/src/lib/libldap5/sources/ldap/common/sasl.c	Sun Aug 09 09:31:03 2009 +0100
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #ifdef LDAP_SASLIO_HOOKS
 #include <assert.h>
 #include "ldap-int.h"
@@ -587,11 +585,22 @@
 	return( LDAP_SUCCESS );
 }
 
+static void
+destroy_sasliobuf(Sockbuf *sb)
+{
+	if (sb != NULL && sb->sb_sasl_ibuf != NULL) {
+		NSLDAPI_FREE(sb->sb_sasl_ibuf);
+		sb->sb_sasl_ibuf = NULL;
+	}
+}
+
 static int
 nsldapi_sasl_close( LDAP *ld, Sockbuf *sb )
 {
 	sasl_conn_t	*ctx = (sasl_conn_t *)sb->sb_sasl_ctx;
 
+	destroy_sasliobuf(sb);
+
 	if( ctx != NULL ) {
 		sasl_dispose( &ctx );
 		sb->sb_sasl_ctx = NULL;