From 0c71ee58938636c3d3ad26d13891ca5d84934f03 Mon Sep 17 00:00:00 2001 From: Milan Jurik Date: Sun, 9 Aug 2009 09:31:03 +0100 Subject: 6851301 libldap5 leaks ~64K per SASL connection --- usr/src/lib/libldap5/sources/ldap/common/sasl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'usr/src/lib/libldap5') diff --git a/usr/src/lib/libldap5/sources/ldap/common/sasl.c b/usr/src/lib/libldap5/sources/ldap/common/sasl.c index 4252da65d5..8f294f9a29 100644 --- a/usr/src/lib/libldap5/sources/ldap/common/sasl.c +++ b/usr/src/lib/libldap5/sources/ldap/common/sasl.c @@ -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 #include "ldap-int.h" @@ -587,11 +585,22 @@ nsldapi_sasl_open(LDAP *ld) 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; -- cgit v1.2.3