#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;
}
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 );
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
*/
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 );
* 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