Commit 826056e7 authored by Howard Chu's avatar Howard Chu
Browse files

More thorough backend_destroy. Added config_destroy. Destroy slap_listeners.

Plugged other small leaks.
parent 3655c575
......@@ -417,7 +417,13 @@ int backend_destroy(void)
backendDB[i].bd_info->bi_db_destroy(
&backendDB[i] );
}
charray_free( backendDB[i].be_suffix );
ber_bvecfree( backendDB[i].be_nsuffix );
free( backendDB[i].be_root_dn );
free( backendDB[i].be_root_ndn );
free( backendDB[i].be_root_pw.bv_val );
}
free( backendDB );
/* destroy each backend type */
for( i = 0; i < nBackendInfo; i++ ) {
......
......@@ -919,11 +919,12 @@ read_config( const char *fname )
#endif
} else {
char *dn = ch_strdup( cargv[1] );
char *dn;
if ( load_ucdata( NULL ) < 0 ) {
return( 1 );
}
dn = ch_strdup( cargv[1] );
if( dn_validate( dn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
......@@ -934,7 +935,7 @@ read_config( const char *fname )
"suffix DN invalid \"%s\"\n",
fname, lineno, cargv[1] );
#endif
free( dn );
return 1;
} else if( *dn == '\0' && default_search_nbase != NULL ) {
......@@ -966,6 +967,7 @@ read_config( const char *fname )
"unable to normalize suffix "
"\"%s\"\n", dn, NULL, NULL );
#endif
free( dn );
return 1;
}
#endif /* USE_LDAP_DN_PARSING */
......@@ -2370,3 +2372,14 @@ load_ucdata( char *path )
loaded = 1;
return( 1 );
}
void
config_destroy( )
{
ucdata_unload( UCDATA_ALL );
free( line );
if ( slapd_args_file )
free ( slapd_args_file );
if ( slapd_pid_file )
free ( slapd_pid_file );
}
......@@ -1675,9 +1675,15 @@ slapd_daemon_task(
}
#endif /* LDAP_PF_LOCAL */
slapd_close( slap_listeners[l]->sl_sd );
break;
}
if ( slap_listeners[l]->sl_url )
free ( slap_listeners[l]->sl_url );
if ( slap_listeners[l]->sl_name )
free ( slap_listeners[l]->sl_name );
free ( slap_listeners[l] );
}
free ( slap_listeners );
slap_listeners = NULL;
#ifdef NEW_LOGGING
LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
......
......@@ -307,9 +307,9 @@ int main( int argc, char **argv )
if( serverName == NULL ) {
if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
serverName = ch_strdup( argv[0] );
serverName = argv[0];
} else {
serverName = ch_strdup( serverName + 1 );
serverName = serverName + 1;
}
}
......@@ -556,6 +556,8 @@ stop:
ldap_pvt_tls_destroy();
#endif
config_destroy();
#ifdef CSRIMALLOC
mal_dumpleaktrace( leakfile );
#endif
......
......@@ -425,6 +425,9 @@ int slap_sasl_destroy( void )
#ifdef HAVE_CYRUS_SASL
sasl_done();
#endif
free( global_host );
global_host = NULL;
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment