From: Pierangelo Masarati Date: Mon, 25 Jul 2005 20:47:39 +0000 (+0000) Subject: plug leaks X-Git-Tag: OPENLDAP_AC_BP~202 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a91ebfac79e4617237143d0b841cd09a6c616c33;p=openldap plug leaks --- diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 251387218f..abd8912f7c 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -401,7 +401,8 @@ struct ldapconn * ldap_back_getconn( Operation *op, SlapReply *rs, ldap_back_send_t sendok ) { struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private; - struct ldapconn *lc, lc_curr = { 0 }; + struct ldapconn *lc, + lc_curr = { 0 }; int refcnt = 1; /* Searches for a ldapconn in the avl tree */ diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index c82239bad4..9b25ed06c6 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -106,7 +106,7 @@ static ConfigTable ldapcfg[] = { ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_ACL_PASSWD, ldap_back_cf_gen, NULL, NULL, NULL }, { "acl-bind", "args", 2, 0, 0, - ARG_STRING|ARG_MAGIC|LDAP_BACK_CFG_ACL_BIND, + ARG_MAGIC|LDAP_BACK_CFG_ACL_BIND, ldap_back_cf_gen, "( OLcfgDbAt:3.4 " "NAME 'olcDbACLBind' " "DESC 'Remote ACL administrative identity auth bind configuration' " @@ -144,7 +144,7 @@ static ConfigTable ldapcfg[] = { ARG_BERVAL|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_PASSWD, ldap_back_cf_gen, NULL, NULL, NULL }, { "idassert-bind", "args", 2, 0, 0, - ARG_STRING|ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_BIND, + ARG_MAGIC|LDAP_BACK_CFG_IDASSERT_BIND, ldap_back_cf_gen, "( OLcfgDbAt:3.7 " "NAME 'olcDbIDAssertBind' " "DESC 'Remote Identity Assertion administrative identity auth bind configuration' " @@ -719,7 +719,7 @@ ldap_back_cf_gen( ConfigArgs *c ) li->url = ldap_charray2str( urllist, " " ); ldap_charray_free( urllist ); #else - li->url = ch_strdup( c->value_string ); + li->url = c->value_string; #endif break; } diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index e85c76866d..15c853c86b 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -40,7 +40,7 @@ typedef struct monitor_callback_t { /* modify callback for user-defined entries */ int (*mc_free)( Entry *e, void *priv ); - /* update callback + /* delete callback for user-defined entries */ void *mc_private; /* opaque pointer to private data */ diff --git a/servers/slapd/back-monitor/cache.c b/servers/slapd/back-monitor/cache.c index 4f5ca062a2..d4c6292a6b 100644 --- a/servers/slapd/back-monitor/cache.c +++ b/servers/slapd/back-monitor/cache.c @@ -280,7 +280,11 @@ monitor_entry_destroy( void *v_mc ) mp = ( monitor_entry_t * )mc->mc_e->e_private; if ( mp->mp_cb ) { - /* TODO */ + if ( mp->mp_cb->mc_free ) { + mp->mp_cb->mc_free( mc->mc_e, + mp->mp_cb->mc_private ); + } + ch_free( mp->mp_cb ); } ldap_pvt_thread_mutex_destroy( &mp->mp_mutex ); diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 042d4b0d58..17ca8812de 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -104,7 +104,6 @@ static ConfigDriver config_sizelimit; static ConfigDriver config_timelimit; static ConfigDriver config_overlay; static ConfigDriver config_suffix; -static ConfigDriver config_deref_depth; static ConfigDriver config_rootdn; static ConfigDriver config_rootpw; static ConfigDriver config_restrict; @@ -1681,7 +1680,9 @@ config_rootpw(ConfigArgs *c) { if (c->op == SLAP_CONFIG_EMIT) { if (!BER_BVISEMPTY(&c->be->be_rootpw)) { - ber_dupbv( &c->value_bv, &c->be->be_rootpw); + /* don't copy, because "rootpw" is marked + * as CFG_BERVAL */ + c->value_bv = c->be->be_rootpw; return 0; } return 1; @@ -1882,6 +1883,15 @@ loglevel_init( void ) return slap_verbmasks_init( &loglevel_ops, lo ); } +static void +loglevel_destroy( void ) +{ + if ( loglevel_ops ) { + (void)slap_verbmasks_destroy( loglevel_ops ); + } + loglevel_ops = NULL; +} + static slap_mask_t loglevel_ignore[] = { -1, 0 }; int @@ -4114,6 +4124,8 @@ config_back_db_destroy( BackendDB *be ) free( be->be_private ); + loglevel_destroy(); + return 0; }