]> git.sur5r.net Git - openldap/commitdiff
Plug mem leaks
authorHoward Chu <hyc@openldap.org>
Mon, 5 Jul 2004 21:00:09 +0000 (21:00 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 5 Jul 2004 21:00:09 +0000 (21:00 +0000)
servers/slapd/back-bdb/cache.c

index 8ef3bd89402966ca1f972235b51756a525cfbb8d..6b6e042493c5a53505ec8daec10ad15bc1edb857 100644 (file)
@@ -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;