Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > cdedc712ab3cd61c674716aaa506265d > files > 38

openldap-2.4.38-1.3.mga4.src.rpm

From: Howard Chu <hyc@openldap.org>
Date: Tue, 3 Dec 2013 22:16:20 +0000 (-0800)
Subject: ITS#7757 plug memleak
X-Git-Url: http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commitdiff_plain;h=167482e63c79dfa326ed71871d93a5bc7377c81e

ITS#7757 plug memleak
---

diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c
index 28c241b..836742f 100644
--- a/libraries/libldap/cyrus.c
+++ b/libraries/libldap/cyrus.c
@@ -545,8 +545,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 ) {
@@ -562,8 +565,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 ) {