From: Kurt Zeilenga Date: Thu, 19 Aug 1999 18:16:04 +0000 (+0000) Subject: Fix MAJOR memory leak. X-Git-Tag: TWEB_OL_BASE~154 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8fcb25216f0743299235c8167f64e4d68d2463d3;p=openldap Fix MAJOR memory leak. --- diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 8d6631d536..849aece201 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -99,14 +99,17 @@ str2entry( char *s ) } if ( strcasecmp( type, "dn" ) == 0 ) { + free( type ); + if ( e->e_dn != NULL ) { Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has multiple dns \"%s\" and \"%s\" (second ignored)\n", e->e_id, e->e_dn, value != NULL ? value : NULL ); + if( value != NULL ) free( value ); continue; } - e->e_dn = ch_strdup( value != NULL ? value : "" ); + e->e_dn = value != NULL ? value : ch_strdup( "" ); if ( e->e_ndn != NULL ) { Debug( LDAP_DEBUG_ANY, @@ -127,8 +130,13 @@ str2entry( char *s ) Debug( LDAP_DEBUG_TRACE, "<= str2entry NULL (attr_merge)\n", 0, 0, 0 ); entry_free( e ); + free( value ); + free( type ); return( NULL ); } + + free( value ); + free( type ); nvals++; }