]> git.sur5r.net Git - openldap/commitdiff
More cleanup
authorHoward Chu <hyc@openldap.org>
Thu, 13 Jan 2011 02:23:04 +0000 (02:23 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 13 Jan 2011 02:23:04 +0000 (02:23 +0000)
servers/slapd/back-monitor/search.c

index 2fd35b4cec5c36f8e8bee11ceed98d8ed4ea55de..4df9d2ac87c96232400c673b81fcf9109c28b835 100644 (file)
@@ -97,8 +97,10 @@ monitor_send_children(
        }
 
        /* return entries */
-       for ( monitor_cache_lock( e ); e != NULL; ) {
+       for ( ; e != NULL; e = e_tmp ) {
                Entry *sub_nv = NULL, *sub_ch = NULL;
+
+               monitor_cache_lock( e );
                monitor_entry_update( op, rs, e );
 
                if ( e == e_nonvolatile )
@@ -122,6 +124,12 @@ monitor_send_children(
                        rs->sr_flags = REP_ENTRY_MUSTRELEASE;
                        rc = send_search_entry( op, rs );
                        if ( rc ) {
+                               for ( e = sub_ch; e != NULL; e = sub_nv ) {
+                                       mp = ( monitor_entry_t * )e->e_private;
+                                       sub_nv = mp->mp_next;
+                                       monitor_cache_lock( e );
+                                       monitor_cache_release( mi, e );
+                               }
                                goto freeout;
                        }
                } else {
@@ -132,7 +140,6 @@ monitor_send_children(
                        rc = monitor_send_children( op, rs, sub_nv, sub_ch, sub );
                        if ( rc ) {
 freeout:
-                               /* FIXME: may leak generated children */
                                if ( nonvolatile == 0 ) {
                                        for ( ; e_tmp != NULL; ) {
                                                mp = ( monitor_entry_t * )e_tmp->e_private;
@@ -150,10 +157,6 @@ freeout:
                                return( rc );
                        }
                }
-
-               e = e_tmp;
-               if ( e )
-                       monitor_cache_lock( e );
        }
        
        return LDAP_SUCCESS;