From: Pierangelo Masarati Date: Sun, 7 Aug 2005 16:38:20 +0000 (+0000) Subject: plug selected leaks at shutdown X-Git-Tag: OPENLDAP_AC_BP~74 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ca00d860d689110e0104ffd61b8e02132423f02a;p=openldap plug selected leaks at shutdown --- diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 14a3c25bf6..78549fbe26 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -1609,7 +1609,7 @@ static ConfigTable pccfg[] = { "DESC 'Filter template, attrset, and cache TTL' " "SYNTAX OMsDirectoryString )", NULL, NULL }, { "response-callback", "head|tail(default)", - 2, 2, 0, ARG_MAGIC|ARG_STRING|PC_RESP, pc_cf_gen, + 2, 2, 0, ARG_MAGIC|PC_RESP, pc_cf_gen, "( OLcfgOvAt:2.4 NAME 'olcProxyResponseCB' " "DESC 'Response callback position in overlay stack' " "SYNTAX OMsDirectoryString )", NULL, NULL }, @@ -1733,11 +1733,9 @@ pc_cf_gen( ConfigArgs *c ) break; case PC_RESP: if ( cm->response_cb == PCACHE_RESPONSE_CB_HEAD ) { - bv.bv_val = "head"; - bv.bv_len = STRLENOF("head"); + BER_BVSTR( &bv, "head" ); } else { - bv.bv_val = "tail"; - bv.bv_len = STRLENOF("tail"); + BER_BVSTR( &bv, "tail" ); } value_add_one( &c->rvalue_vals, &bv ); break; @@ -2026,17 +2024,24 @@ proxy_cache_destroy( slap_overinst *on = (slap_overinst *)be->bd_info; cache_manager *cm = on->on_bi.bi_private; query_manager *qm = cm->qm; - int rc = 0; - if ( cm->db.bd_info->bi_db_destroy ) { - rc = cm->db.bd_info->bi_db_destroy( &cm->db ); - } - ldap_pvt_thread_mutex_destroy(&qm->lru_mutex); - ldap_pvt_thread_mutex_destroy(&cm->cache_mutex); - ldap_pvt_thread_mutex_destroy(&cm->remove_mutex); + /* cleanup stuff inherited from the original database... */ + cm->db.be_suffix = NULL; + cm->db.be_nsuffix = NULL; + BER_BVZERO( &cm->db.be_rootdn ); + BER_BVZERO( &cm->db.be_rootndn ); + BER_BVZERO( &cm->db.be_rootpw ); + /* FIXME: there might be more... */ + + backend_destroy_one( &cm->db, 0 ); + + ldap_pvt_thread_mutex_destroy( &qm->lru_mutex ); + ldap_pvt_thread_mutex_destroy( &cm->cache_mutex ); + ldap_pvt_thread_mutex_destroy( &cm->remove_mutex ); free( qm ); free( cm ); - return rc; + + return 0; } static slap_overinst proxy_cache;