]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/pcache.c
Happy New Year
[openldap] / servers / slapd / overlays / pcache.c
index 20f1558abfc3ad7735aa6704f3e7ebdbae57bdd5..c44a932af85c8a5ddb16ce27f24990cb703e038f 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2014 The OpenLDAP Foundation.
+ * Copyright 2003-2018 The OpenLDAP Foundation.
  * Portions Copyright 2003 IBM Corporation.
  * Portions Copyright 2003-2009 Symas Corporation.
  * All rights reserved.
@@ -65,7 +65,7 @@ typedef struct Query_s {
 struct query_template_s;
 
 typedef struct Qbase_s {
-       Avlnode *scopes[4];             /* threaded AVL trees of cached queries */
+       TAvlnode *scopes[4];            /* threaded AVL trees of cached queries */
        struct berval base;
        int queries;
 } Qbase;
@@ -456,8 +456,10 @@ ftemp_attrs( struct berval *ftemp, struct berval *template,
 
                p2 = strchr( p1, '=' );
                if ( !p2 ) {
-                       if ( !descs )
+                       if ( !descs ) {
+                               ch_free( temp2 );
                                return -1;
+                       }
                        break;
                }
                i = p2 - p1;
@@ -471,6 +473,7 @@ ftemp_attrs( struct berval *ftemp, struct berval *template,
                ad = NULL;
                i = slap_bv2ad( &bv, &ad, text );
                if ( i ) {
+                       ch_free( temp2 );
                        ch_free( descs );
                        return -1;
                }
@@ -566,6 +569,7 @@ bottom:
        }
        if ( !t_cnt ) {
                *text = "couldn't parse template";
+               ch_free(attrs);
                return -1;
        }
        if ( !got_oc && !( set->flags & PC_GOT_OC )) {
@@ -1268,14 +1272,14 @@ typedef struct fstack {
 } fstack;
 
 static CachedQuery *
-find_filter( Operation *op, Avlnode *root, Filter *inputf, Filter *first )
+find_filter( Operation *op, TAvlnode *root, Filter *inputf, Filter *first )
 {
        Filter* fs;
        Filter* fi;
        MatchingRule* mrule = NULL;
        int res=0, eqpass= 0;
        int ret, rc, dir;
-       Avlnode *ptr;
+       TAvlnode *ptr;
        CachedQuery cq, *qc;
        fstack *stack = NULL, *fsp;
 
@@ -2834,7 +2838,7 @@ pcache_op_bind(
        QueryTemplate *temp;
        Entry *e;
        slap_callback   cb = { 0 }, *sc;
-       bindinfo bi;
+       bindinfo bi = { 0 };
        bindcacheinfo *bci;
        Operation op2;
        int rc;
@@ -2864,7 +2868,6 @@ pcache_op_bind(
        op2 = *op;
        op2.o_dn = op->o_bd->be_rootdn;
        op2.o_ndn = op->o_bd->be_rootndn;
-       bi.bi_flags = 0;
 
        op2.o_bd = &cm->db;
        e = NULL;
@@ -2893,11 +2896,8 @@ pcache_op_bind(
         */
        bi.bi_cm = cm;
        bi.bi_templ = temp;
-       bi.bi_cq = NULL;
-       bi.bi_si = NULL;
 
        bi.bi_cb.sc_response = pc_bind_search;
-       bi.bi_cb.sc_cleanup = NULL;
        bi.bi_cb.sc_private = &bi;
        cb.sc_private = &bi;
        cb.sc_response = pc_bind_resp;
@@ -2933,6 +2933,7 @@ pcache_op_bind(
                sc->sc_response = pc_bind_save;
                sc->sc_cleanup = NULL;
                sc->sc_private = sc+1;
+               sc->sc_writewait = NULL;
                bci = sc->sc_private;
                sc->sc_next = op->o_callback;
                op->o_callback = sc;
@@ -3125,6 +3126,7 @@ pcache_op_search(
                cb->sc_response = pcache_response;
                cb->sc_cleanup = pcache_op_cleanup;
                cb->sc_private = (cb+1);
+               cb->sc_writewait = 0;
                si = cb->sc_private;
                si->on = on;
                si->query = query;