From: Howard Chu Date: Mon, 5 Jul 2004 21:00:09 +0000 (+0000) Subject: Plug mem leaks X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~116 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6b59008f263b5ebb32237b0b08b903ce8fe6b766;p=openldap Plug mem leaks --- 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;