From 6b59008f263b5ebb32237b0b08b903ce8fe6b766 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 5 Jul 2004 21:00:09 +0000 Subject: [PATCH] Plug mem leaks --- servers/slapd/back-bdb/cache.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/servers/slapd/back-bdb/cache.c b/servers/slapd/back-bdb/cache.c index 8ef3bd8940..6b6e042493 100644 --- a/servers/slapd/back-bdb/cache.c +++ b/servers/slapd/back-bdb/cache.c @@ -686,6 +686,7 @@ again: ldap_pvt_thread_rdwr_rlock( &bdb->bi_cache.c_rwlock ); bdb_fix_dn( ep, 0 ); #endif (*eip)->bei_e = ep; + ep = NULL; } } bdb_cache_entry_db_relock( bdb->bi_dbenv, locker, @@ -713,6 +714,9 @@ again: ldap_pvt_thread_rdwr_rlock( &bdb->bi_cache.c_rwlock ); if ( islocked ) { bdb_cache_entryinfo_unlock( *eip ); } + if ( ep ) { + bdb_entry_return( ep ); + } if ( rc == 0 ) { /* set lru mutex */ ldap_pvt_thread_mutex_lock( &bdb->bi_cache.lru_mutex ); @@ -1077,6 +1081,10 @@ bdb_cache_release_all( Cache *cache ) avl_free( cache->c_dntree.bei_kids, NULL ); avl_free( cache->c_idtree, bdb_entryinfo_release ); + for (;cache->c_eifree;cache->c_eifree = cache->c_lruhead) { + cache->c_lruhead = cache->c_eifree->bei_lrunext; + bdb_cache_entryinfo_destroy(cache->c_eifree); + } cache->c_lruhead = NULL; cache->c_lrutail = NULL; -- 2.39.5