]> git.sur5r.net Git - openldap/commitdiff
ITS#7757 plug memleak
authorHoward Chu <hyc@openldap.org>
Tue, 3 Dec 2013 22:16:20 +0000 (14:16 -0800)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 4 Dec 2013 18:37:26 +0000 (10:37 -0800)
libraries/libldap/cyrus.c

index 28c241b0bf47b508ed34b82a9f958467cb1967d0..836742faf3abe85671d94a84b28e7b67c53098d9 100644 (file)
@@ -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 ) {