Fixing memory leakage in attribute aliasing

This commit is contained in:
Sang Seok Lim 2005-03-29 00:12:05 +00:00
parent 7c91b8a327
commit d2af85fd08
6 changed files with 48 additions and 2 deletions

View File

@ -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 );
}

View File

@ -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
/*

View File

@ -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;

View File

@ -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 };

View File

@ -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;

View File

@ -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;