From: Pierangelo Masarati Date: Wed, 20 Jul 2005 14:59:56 +0000 (+0000) Subject: destroy cache on exit X-Git-Tag: OPENLDAP_AC_BP~307 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3df83d7089dafffcb08baa35120cf6071935eddf;p=openldap destroy cache on exit --- diff --git a/servers/slapd/back-monitor/cache.c b/servers/slapd/back-monitor/cache.c index 086a833713..4f5ca062a2 100644 --- a/servers/slapd/back-monitor/cache.c +++ b/servers/slapd/back-monitor/cache.c @@ -267,3 +267,40 @@ monitor_cache_release( return( 0 ); } +static void +monitor_entry_destroy( void *v_mc ) +{ + monitor_cache_t *mc = (monitor_cache_t *)v_mc; + + if ( mc->mc_e != NULL ) { + monitor_entry_t *mp; + + assert( mc->mc_e->e_private != NULL ); + + mp = ( monitor_entry_t * )mc->mc_e->e_private; + + if ( mp->mp_cb ) { + /* TODO */ + } + + ldap_pvt_thread_mutex_destroy( &mp->mp_mutex ); + + ch_free( mp ); + mc->mc_e->e_private = NULL; + entry_free( mc->mc_e ); + } + + ch_free( mc ); +} + +int +monitor_cache_destroy( + monitor_info_t *mi ) +{ + if ( mi->mi_cache ) { + avl_free( mi->mi_cache, monitor_entry_destroy ); + } + + return 0; +} + diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index e3cac86c00..0213b9349e 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -1706,7 +1706,9 @@ monitor_back_db_config( int argc, char **argv ) { +#if 0 monitor_info_t *mi = ( monitor_info_t * )be->be_private; +#endif /* * eventually, will hold database specific configuration parameters @@ -1725,6 +1727,12 @@ monitor_back_db_destroy( */ /* NOTE: mi points to static storage; don't free it */ + (void)monitor_cache_destroy( mi ); + + if ( monitor_subsys ) { + ch_free( monitor_subsys ); + } + return 0; } diff --git a/servers/slapd/back-monitor/proto-back-monitor.h b/servers/slapd/back-monitor/proto-back-monitor.h index d73bf61d6b..6de478a1cc 100644 --- a/servers/slapd/back-monitor/proto-back-monitor.h +++ b/servers/slapd/back-monitor/proto-back-monitor.h @@ -68,6 +68,10 @@ monitor_cache_release LDAP_P(( monitor_info_t *mi, Entry *e )); +extern int +monitor_cache_destroy LDAP_P(( + monitor_info_t *mi )); + /* * connections */