From f8efeb42783f958dd0dc997f8084e6b3b4502830 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 3 Dec 2013 14:16:20 -0800 Subject: [PATCH] ITS#7757 plug memleak --- libraries/libldap/cyrus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index a57292800b..b8dd81afb2 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -567,8 +567,11 @@ ldap_int_sasl_bind( ctx = ld->ld_defconn->lconn_sasl_authctx; rc = ldap_parse_sasl_bind_result( ld, result, &scred, 0 ); - if ( rc != LDAP_SUCCESS ) + if ( rc != LDAP_SUCCESS ) { + if ( scred ) + ber_bvfree( scred ); goto done; + } rc = ldap_result2error( ld, result, 0 ); if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) { @@ -584,8 +587,11 @@ ldap_int_sasl_bind( } mech = *rmech; - if ( rc == LDAP_SUCCESS && mech == NULL ) + if ( rc == LDAP_SUCCESS && mech == NULL ) { + if ( scred ) + ber_bvfree( scred ); goto success; + } do { if( ! scred ) { -- 2.39.5