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

Memory leak in ldap_first_attribute()? (ITS#1009)

Full_Name: Thomas Kemmer
Version: 2.0.7
OS: Linux 2.x
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

Hi all,

when debugging an LDAP client with -DLDAP_MEMORY_TRACE, I stumbled over
that looks like a 44 byte memory leak that occurs sometimes in 
ldap_first_attribute(). The suspicious code is in libraries/libldap/getattr.c, 
around line 71:

	if ( ber_pvt_ber_remaining( ber ) == 0 ) {
		assert( len == 0 );
		return NULL;

Inserting a 

		ber_free( ber, 0 );

before the return statement seems to fix this problem.

Since I'm not an expert with the inner workings of libldap, I'd ask you to
that this doesn't have any unwanted side-effects, please...