]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/rwm.c
Plug memleak when query isn't added to cache
[openldap] / servers / slapd / overlays / rwm.c
index 6246cc68a6919d1885e6df0506bcab5173398cd0..2880ed8f6c89f9d6960bb44df78801625b117e85 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2005 The OpenLDAP Foundation.
+ * Copyright 2003-2006 The OpenLDAP Foundation.
  * Portions Copyright 2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -1043,6 +1043,7 @@ rwm_send_entry( Operation *op, SlapReply *rs )
                        goto fail;
                }
 
+               flags &= ~REP_ENTRY_MUSTRELEASE;
                flags |= ( REP_ENTRY_MODIFIABLE | REP_ENTRY_MUSTBEFREED );
        }
 
@@ -1075,11 +1076,9 @@ rwm_send_entry( Operation *op, SlapReply *rs )
         * to return, and remap them accordingly */
        (void)rwm_attrs( op, rs, &e->e_attrs, 1 );
 
-#if 0
-       if ( rs->sr_operational_attrs ) {
-               (void)rwm_attrs( op, rs, &rs->sr_operational_attrs, 0 );
+       if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
+               be_entry_release_rw( op, rs->sr_entry, 0 );
        }
-#endif
 
        rs->sr_entry = e;
        rs->sr_flags = flags;
@@ -1482,7 +1481,7 @@ rwm_db_destroy(
                        (struct ldaprwmap *)on->on_bi.bi_private;
 
 #ifdef ENABLE_REWRITE
-               if (rwmap->rwm_rw) {
+               if ( rwmap->rwm_rw ) {
                        rewrite_info_delete( &rwmap->rwm_rw );
                }
 #else /* !ENABLE_REWRITE */
@@ -1491,9 +1490,9 @@ rwm_db_destroy(
                }
 #endif /* !ENABLE_REWRITE */
 
-               avl_free( rwmap->rwm_oc.remap, NULL );
+               avl_free( rwmap->rwm_oc.remap, rwm_mapping_dst_free );
                avl_free( rwmap->rwm_oc.map, rwm_mapping_free );
-               avl_free( rwmap->rwm_at.remap, NULL );
+               avl_free( rwmap->rwm_at.remap, rwm_mapping_dst_free );
                avl_free( rwmap->rwm_at.map, rwm_mapping_free );
 
                ch_free( rwmap );
@@ -1505,7 +1504,7 @@ rwm_db_destroy(
 static slap_overinst rwm = { { NULL } };
 
 int
-rwm_init(void)
+rwm_initialize(void)
 {
        memset( &rwm, 0, sizeof( slap_overinst ) );
 
@@ -1542,7 +1541,7 @@ rwm_init(void)
 int
 init_module( int argc, char *argv[] )
 {
-       return rwm_init();
+       return rwm_initialize();
 }
 #endif /* SLAPD_OVER_RWM == SLAPD_MOD_DYNAMIC */