]> git.sur5r.net Git - openldap/commitdiff
release entry (ITS#5135)
authorPierangelo Masarati <ando@openldap.org>
Fri, 14 Sep 2007 22:39:49 +0000 (22:39 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 14 Sep 2007 22:39:49 +0000 (22:39 +0000)
servers/slapd/overlays/dynlist.c

index 7082fb253ad0f6d1b3d59c5a604b31b58b9f3af4..85d45205284a2d6574e4ebe02293a46644d5f20a 100644 (file)
@@ -548,7 +548,7 @@ dynlist_compare( Operation *op, SlapReply *rs )
        slap_overinst   *on = (slap_overinst *)op->o_bd->bd_info;
        dynlist_info_t  *dli = (dynlist_info_t *)on->on_bi.bi_private;
        Operation o = *op;
-       Entry *e;
+       Entry *e = NULL;
 
        for ( ; dli != NULL; dli = dli->dli_next ) {
                if ( op->oq_compare.rs_ava->aa_desc == dli->dli_member_ad ) {
@@ -631,14 +631,14 @@ dynlist_compare( Operation *op, SlapReply *rs )
 
                o.o_bd = select_backend( &o.o_req_ndn, 1 );
                if ( !o.o_bd || !o.o_bd->be_search ) {
-                       return SLAP_CB_CONTINUE;
+                       goto release;
                }
 
                BER_BVSTR( &o.ors_filterstr, "(objectClass=*)" );
                o.ors_filter = str2filter_x( op, o.ors_filterstr.bv_val );
                if ( o.ors_filter == NULL ) {
                        /* FIXME: error? */
-                       return SLAP_CB_CONTINUE;
+                       goto release;
                }
 
                o.ors_scope = LDAP_SCOPE_BASE;
@@ -659,7 +659,7 @@ dynlist_compare( Operation *op, SlapReply *rs )
                }
 
                if ( rc != 0 ) {
-                       return rc;
+                       goto release;
                }
 
                if ( dlc.dlc_e != NULL ) {
@@ -668,7 +668,7 @@ dynlist_compare( Operation *op, SlapReply *rs )
 
                if ( r.sr_err != LDAP_SUCCESS || r.sr_entry == NULL ) {
                        /* error? */
-                       return SLAP_CB_CONTINUE;
+                       goto release;
                }
 
                for ( a = attrs_find( r.sr_entry->e_attrs, op->orc_ava->aa_desc );
@@ -693,6 +693,11 @@ dynlist_compare( Operation *op, SlapReply *rs )
                }
        }
 
+release:;
+       if ( e != NULL ) {
+               overlay_entry_release_ov( &o, e, 0, on );
+       }
+
        return SLAP_CB_CONTINUE;
 }
 
@@ -1343,7 +1348,8 @@ dynlist_db_open(
 
        rc = slap_str2ad( "dgIdentity", &ad_dgIdentity, &text );
        if ( rc != LDAP_SUCCESS ) {
-               sprintf( cr->msg, "unable to fetch attributeDescription \"dgIdentity\": %d (%s)",
+               snprintf( cr->msg, sizeof( cr->msg),
+                       "unable to fetch attributeDescription \"dgIdentity\": %d (%s)",
                        rc, text );
                Debug( LDAP_DEBUG_ANY, "dynlist_db_open: %s\n", cr->msg, 0, 0 );
                /* Just a warning */