Plug memory leaks

This commit is contained in:
Hallvard Furuseth 2005-08-01 03:44:52 +00:00
parent 71d76fbeba
commit a286d07109
3 changed files with 10 additions and 1 deletions

View file

@ -717,6 +717,9 @@ tool_args( int argc, char **argv )
LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION );
if (version > 1) exit( EXIT_SUCCESS );
}
ldap_memfree( api.ldapai_vendor_name );
ldap_value_free( api.ldapai_extensions );
}
if (protocol == -1)
@ -971,6 +974,9 @@ tool_bind( LDAP *ld )
}
}
#endif
if ( ctrls ) {
ldap_controls_free( ctrls );
}
if ( err != LDAP_SUCCESS || msgbuf[0] ) {
fprintf( stderr, "ldap_bind: %s%s\n", ldap_err2string( err ),
msgbuf );

View file

@ -720,6 +720,9 @@ end_line:
if ( newrdn != NULL ) {
free( newrdn );
}
if ( newsup != NULL ) {
free( newsup );
}
if ( pmods != NULL ) {
ldap_mods_free( pmods, 1 );
}

View file

@ -603,7 +603,7 @@ main( int argc, char **argv )
{
filtpattern = "(objectclass=*)";
} else {
filtpattern = strdup( argv[optind++] );
filtpattern = argv[optind++];
}
if ( argv[optind] != NULL ) {