]> git.sur5r.net Git - openldap/commitdiff
Fixing memory leakage in attribute aliasing
authorSang Seok Lim <slim@openldap.org>
Tue, 29 Mar 2005 00:12:05 +0000 (00:12 +0000)
committerSang Seok Lim <slim@openldap.org>
Tue, 29 Mar 2005 00:12:05 +0000 (00:12 +0000)
servers/slapd/ava.c
servers/slapd/back-bdb/search.c
servers/slapd/compare.c
servers/slapd/overlays/pcache.c
servers/slapd/overlays/syncprov.c
servers/slapd/syncrepl.c

index d0df3d7c263547e18036666bcf53ecd57060b575..48c9b5a03f8c2516c91e9b39db324e721bfe6ac6 100644 (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 );
 }
index b2f34ed8b7acaae61c529e9b57094421cb377b34..e9f987fe7b46ccb1b1f29e54ec7abbea88c41481 100644 (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
 
        /*
index 38e9448d040883f49bea220b9cf5f2290f500c3f..d43af1c0164130907484859a7659e3c39a5e40a7 100644 (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;
 
index 43e2daa91ddd7e979156bf8c7961972236a1c387..88268f141e02002b0da37f9d313015270e11ed88 100644 (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 };
index c406f5b1fa7fe206f4d7c93da9a7aa9c9c9c44da..05b6606ad15e5855637c6cca409ef957c5e2e308 100644 (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;
index 58fca6ce87bf17e73c3ddae56545ec3c58d66460..a0dc17b76a5ae2ab720ce33b20af981911f32293 100644 (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;