From: Sang Seok Lim Date: Tue, 29 Mar 2005 00:12:05 +0000 (+0000) Subject: Fixing memory leakage in attribute aliasing X-Git-Tag: OPENLDAP_AC_BP~1048 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d2af85fd08dd26964acb7bb8f040fe35bd7bbd17;p=openldap Fixing memory leakage in attribute aliasing --- diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index d0df3d7c26..48c9b5a03f 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -43,6 +43,10 @@ ava_free( AttributeAssertion *ava, int freeit ) { +#ifdef LDAP_COMP_MATCH + if ( ava->aa_cf && ava->aa_cf->cf_ca->ca_comp_data.cd_mem_op ) + nibble_mem_free ( ava->aa_cf->cf_ca->ca_comp_data.cd_mem_op ); +#endif op->o_tmpfree( ava->aa_value.bv_val, op->o_tmpmemctx ); if ( freeit ) op->o_tmpfree( (char *) ava, op->o_tmpmemctx ); } diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index b2f34ed8b7..e9f987fe7b 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -150,7 +150,11 @@ static int search_aliases( Entry *matched, *a; EntryInfo *ei; struct berval bv_alias = BER_BVC( "alias" ); +#ifdef LDAP_COMP_MATCH AttributeAssertion aa_alias = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion aa_alias = { NULL, BER_BVNULL }; +#endif Filter af; DB_LOCK locka, lockr; int first = 1; @@ -1016,10 +1020,18 @@ static int search_candidates( int rc, depth = 1; Filter f, rf, xf, nf; ID *stack; +#ifdef LDAP_COMP_MATCH AttributeAssertion aa_ref = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion aa_ref = { NULL, BER_BVNULL }; +#endif #ifdef BDB_SUBENTRIES Filter sf; +#ifdef LDAP_COMP_MATCH AttributeAssertion aa_subentry = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion aa_subentry = { NULL, BER_BVNULL }; +#endif #endif /* diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 38e9448d04..d43af1c016 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -47,7 +47,11 @@ do_compare( struct berval dn = BER_BVNULL; struct berval desc = BER_BVNULL; struct berval value = BER_BVNULL; +#ifdef LDAP_COMP_MATCH AttributeAssertion ava = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion ava = { NULL, BER_BVNULL }; +#endif ava.aa_desc = NULL; diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 43e2daa91d..88268f141e 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -789,7 +789,11 @@ remove_query_data ( { struct query_info *qi, *qnext; char filter_str[64]; - AttributeAssertion ava; +#ifdef LDAP_COMP_MATCH + AttributeAssertion ava = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion ava = { NULL, BER_BVNULL }; +#endif Filter filter = {LDAP_FILTER_EQUALITY}; SlapReply sreply = {REP_RESULT}; slap_callback cb = { NULL, remove_func, NULL, NULL }; diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index c406f5b1fa..05b6606ad1 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -604,7 +604,11 @@ syncprov_findcsn( Operation *op, int mode ) char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; struct berval fbuf, maxcsn; Filter cf, af; - AttributeAssertion eq; +#ifdef LDAP_COMP_MATCH + AttributeAssertion eq = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion eq = { NULL, BER_BVNULL }; +#endif int i, rc = LDAP_SUCCESS; fpres_cookie pcookie; sync_control *srs = NULL; @@ -1241,7 +1245,11 @@ syncprov_playlog( Operation *op, SlapReply *rs, sessionlog *sl, SlapReply frs = { REP_RESULT }; int rc; Filter mf, af; +#ifdef LDAP_COMP_MATCH + AttributeAssertion eq = { NULL, BER_BVNULL, NULL }; +#else AttributeAssertion eq; +#endif slap_callback cb = {0}; fop = *op; @@ -1868,6 +1876,9 @@ shortcut: fava->f_choice = LDAP_FILTER_LE; fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx ); fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN; +#ifdef LDAP_COMP_MATCH + fava->f_ava->aa_cf = NULL; +#endif ber_dupbv_x( &fava->f_ava->aa_value, &ctxcsn, op->o_tmpmemctx ); fand->f_and = fava; if ( gotstate ) { @@ -1876,6 +1887,9 @@ shortcut: fava->f_choice = LDAP_FILTER_GE; fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx ); fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN; +#ifdef LDAP_COMP_MATCH + fava->f_ava->aa_cf = NULL; +#endif ber_dupbv_x( &fava->f_ava->aa_value, &srs->sr_state.ctxcsn, op->o_tmpmemctx ); } fava->f_next = op->ors_filter; diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 58fca6ce87..a0dc17b76a 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1153,7 +1153,11 @@ syncrepl_entry( SlapReply rs_add = {REP_RESULT}; SlapReply rs_modify = {REP_RESULT}; Filter f = {0}; +#ifdef LDAP_COMP_MATCH AttributeAssertion ava = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion ava = { NULL, BER_BVNULL }; +#endif int rc = LDAP_SUCCESS; int ret = LDAP_SUCCESS; @@ -1548,7 +1552,11 @@ syncrepl_del_nonpresent( if ( uuids ) { Filter uf; +#ifdef LDAP_COMP_MATCH AttributeAssertion eq = { NULL, BER_BVNULL, NULL }; +#else + AttributeAssertion eq = { NULL, BER_BVNULL }; +#endif int i; op->ors_attrsonly = 1;