From: Kurt Zeilenga Date: Tue, 6 Nov 2001 17:05:51 +0000 (+0000) Subject: Plug leaks (ITS#1116) X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~894 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ac3e6c8dc52860c423e6acaadb154d14ede02e89;p=openldap Plug leaks (ITS#1116) Patch provided by John Morrissey --- diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 3c528561e2..d262410e33 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -419,6 +419,7 @@ ldap_int_sasl_open( rc = sasl_client_new( "ldap", host, session_callbacks, SASL_SECURITY_LAYER, &ctx ); + ber_memfree( session_callbacks ); if ( rc != SASL_OK ) { ld->ld_errno = sasl_err2ldap( rc ); diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 25e0519edf..943d61994b 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -358,6 +358,7 @@ ldap_int_open_connection( that SASL EXTERNAL might be used */ if( sasl_host != NULL ) { ldap_int_sasl_open( ld, conn, sasl_host, sasl_ssf ); + LDAP_FREE( sasl_host ); } #endif diff --git a/libraries/libldap/unbind.c b/libraries/libldap/unbind.c index b138161a41..bc19269c3b 100644 --- a/libraries/libldap/unbind.c +++ b/libraries/libldap/unbind.c @@ -131,6 +131,26 @@ ldap_ld_free( ld->ld_options.ldo_tm_net = NULL; } + if ( ld->ld_options.ldo_def_sasl_mech != NULL ) { + LDAP_FREE( ld->ld_options.ldo_def_sasl_mech ); + ld->ld_options.ldo_def_sasl_mech = NULL; + } + + if ( ld->ld_options.ldo_def_sasl_realm != NULL ) { + LDAP_FREE( ld->ld_options.ldo_def_sasl_realm ); + ld->ld_options.ldo_def_sasl_realm = NULL; + } + + if ( ld->ld_options.ldo_def_sasl_authcid != NULL ) { + LDAP_FREE( ld->ld_options.ldo_def_sasl_authcid ); + ld->ld_options.ldo_def_sasl_authcid = NULL; + } + + if ( ld->ld_options.ldo_def_sasl_authzid != NULL ) { + LDAP_FREE( ld->ld_options.ldo_def_sasl_authzid ); + ld->ld_options.ldo_def_sasl_authzid = NULL; + } + ber_sockbuf_free( ld->ld_sb ); LDAP_FREE( (char *) ld );