From 720aa4b77e1e6df23e0d04847e630b302384a95d Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 20 Dec 2010 10:57:06 +0000 Subject: [PATCH] Plug mutex/rwlock leaks (destroy them) --- servers/slapd/back-bdb/cache.c | 1 + servers/slapd/backend.c | 3 +++ servers/slapd/overlays/pcache.c | 2 ++ servers/slapd/overlays/syncprov.c | 1 + servers/slapd/overlays/translucent.c | 1 + 5 files changed, 8 insertions(+) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 39a7d290c8..a42db5c5a2 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -101,6 +101,7 @@ bdb_cache_entryinfo_free( Cache *cache, EntryInfo *ei ) cache->c_eifree = ei; ldap_pvt_thread_mutex_unlock( &cache->c_eifree_mutex ); #else + ldap_pvt_thread_mutex_destroy( &ei->bei_kids_mutex ); ch_free( ei ); #endif } diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 58ec6ffb6f..a3695ec1be 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -474,6 +474,8 @@ void backend_destroy_one( BackendDB *bd, int dynamic ) ber_bvarray_free( bd->be_update_refs ); } + ldap_pvt_thread_mutex_destroy( &bd->be_pcl_mutex ); + if ( dynamic ) { free( bd ); } @@ -623,6 +625,7 @@ backend_db_init( /* If we created and linked this be, remove it and free it */ if ( !b0 ) { LDAP_STAILQ_REMOVE(&backendDB, be, BackendDB, be_next); + ldap_pvt_thread_mutex_destroy( &be->be_pcl_mutex ); ch_free( be ); be = NULL; nbackends--; diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 26e28e7de9..ea9820b045 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1599,6 +1599,8 @@ add_query( templ->query = new_cached_query; templ->no_of_queries++; } else { + ldap_pvt_thread_mutex_destroy(&new_cached_query->answerable_cnt_mutex); + ldap_pvt_thread_rdwr_destroy( &new_cached_query->rwlock ); ch_free( new_cached_query ); new_cached_query = find_filter( op, qbase->scopes[query->scope], query->filter, first ); diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index b457f4d0e5..72730c0686 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -3170,6 +3170,7 @@ syncprov_db_destroy( se = se_next; } + ldap_pvt_thread_mutex_destroy(&si->si_logs->sl_mutex); ch_free( si->si_logs ); } if ( si->si_ctxcsn ) diff --git a/servers/slapd/overlays/translucent.c b/servers/slapd/overlays/translucent.c index d6ac0691a0..63f283c009 100644 --- a/servers/slapd/overlays/translucent.c +++ b/servers/slapd/overlays/translucent.c @@ -1383,6 +1383,7 @@ translucent_db_destroy( BackendDB *be, ConfigReply *cr ) backend_stopdown_one( &ov->db ); } + ldap_pvt_thread_mutex_destroy( &ov->db.be_pcl_mutex ); ch_free(ov); on->on_bi.bi_private = NULL; } -- 2.39.5