plug (one time?) leaks

This commit is contained in:
Pierangelo Masarati 2005-11-03 10:52:58 +00:00
parent f7ebf67355
commit 4e5eb991eb
2 changed files with 25 additions and 14 deletions

View File

@ -81,10 +81,13 @@ rewrite_info_init(
#ifdef USE_REWRITE_LDAP_PVT_THREADS
if ( ldap_pvt_thread_rdwr_init( &info->li_cookies_mutex ) ) {
avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
if ( ldap_pvt_thread_rdwr_init( &info->li_params_mutex ) ) {
ldap_pvt_thread_rdwr_destroy( &info->li_cookies_mutex );
avl_free( info->li_context, rewrite_context_free );
free( info );
return NULL;
}
@ -116,7 +119,7 @@ rewrite_info_delete(
if ( info->li_maps ) {
avl_free( info->li_maps, rewrite_builtin_map_free );
}
info->li_context = NULL;
info->li_maps = NULL;
rewrite_session_destroy( info );

View File

@ -302,6 +302,25 @@ rewrite_session_var_get(
return REWRITE_SUCCESS;
}
static void
rewrite_session_free( void *v_session )
{
struct rewrite_session *session = (struct rewrite_session *)v_session;
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wlock( &session->ls_vars_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
rewrite_var_delete( session->ls_vars );
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wunlock( &session->ls_vars_mutex );
ldap_pvt_thread_rdwr_destroy( &session->ls_vars_mutex );
ldap_pvt_thread_mutex_unlock( &session->ls_mutex );
ldap_pvt_thread_mutex_destroy( &session->ls_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
}
/*
* Deletes a session
*/
@ -329,18 +348,7 @@ rewrite_session_delete(
return REWRITE_SUCCESS;
}
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wlock( &session->ls_vars_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
rewrite_var_delete( session->ls_vars );
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wunlock( &session->ls_vars_mutex );
ldap_pvt_thread_rdwr_destroy( &session->ls_vars_mutex );
ldap_pvt_thread_mutex_unlock( &session->ls_mutex );
ldap_pvt_thread_mutex_destroy( &session->ls_mutex );
#endif /* USE_REWRITE_LDAP_PVT_THREADS */
rewrite_session_free( session );
#ifdef USE_REWRITE_LDAP_PVT_THREADS
ldap_pvt_thread_rdwr_wlock( &info->li_cookies_mutex );
@ -382,7 +390,7 @@ rewrite_session_destroy(
* Should call per-session destruction routine ...
*/
count = avl_free( info->li_cookies, NULL );
count = avl_free( info->li_cookies, rewrite_session_free );
info->li_cookies = NULL;
#if 0