]> git.sur5r.net Git - openldap/commitdiff
plug selected leaks at shutdown
authorPierangelo Masarati <ando@openldap.org>
Sun, 7 Aug 2005 16:38:20 +0000 (16:38 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 7 Aug 2005 16:38:20 +0000 (16:38 +0000)
servers/slapd/overlays/pcache.c

index 14a3c25bf63e27da52bab688c369ac5e268806e9..78549fbe26a80b00badb47ff69c219aeed8ea32d 100644 (file)
@@ -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;