[Date Prev][Date Next] [Chronological] [Thread] [Top]

Memory leak in ldap_start_tls_s (ITS#2486)



Full_Name: Per Allansson
Version: 2.1.17
OS: Solaris 8
URL: 
Submission from: (NULL) (193.12.107.226)


When calling ldap_start_tls_s() when connected against an OpenLDAP server not
supporting SSL/TLS (in this case the one included with Solaris 8) memory is
leaked. The problem is that ldap_extended_operation_s() returns 
rc != LDAP_SUCCESS and have allocated rspoid/rspdata which won't get freed.
Moving the *free() operations in ldap_start_tls_s() solves this:

            ...

	rc = ldap_extended_operation_s( ld, LDAP_EXOP_START_TLS,
		NULL, serverctrls, clientctrls, &rspoid, &rspdata );

	if ( rspoid != NULL ) {
		LDAP_FREE(rspoid);
	}

	if ( rspdata != NULL ) {
		ber_bvfree( rspdata );
	}

	if ( rc != LDAP_SUCCESS ) {
		return rc;
	}

           ...