Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/events.c

    r414 r427  
    106106        if ((ev->timer_events != NULL)
    107107            && (timeval_compare(&now, &ev->timer_events->next_event) >= 0)) {
     108                /* this older events system did not auto-free timed
     109                   events on running them, and had a race condition
     110                   where the event could be called twice if the
     111                   talloc_free of the te happened after the callback
     112                   made a call which invoked the event loop. To avoid
     113                   this while still allowing old code which frees the
     114                   te, we need to create a temporary context which
     115                   will be used to ensure the te is freed. We also
     116                   remove the te from the timed event list before we
     117                   call the handler, to ensure we can't loop */
     118
     119                struct tevent_timer *te = ev->timer_events;
     120                TALLOC_CTX *tmp_ctx = talloc_new(ev);
    108121
    109122                DEBUG(10, ("Running timed event \"%s\" %p\n",
    110123                           ev->timer_events->handler_name, ev->timer_events));
    111124
    112                 ev->timer_events->handler(ev, ev->timer_events, now,
    113                                           ev->timer_events->private_data);
     125                DLIST_REMOVE(ev->timer_events, te);
     126                talloc_steal(tmp_ctx, te);
     127
     128                te->handler(ev, te, now, te->private_data);
     129
     130                talloc_free(tmp_ctx);
    114131                return true;
    115132        }
Note: See TracChangeset for help on using the changeset viewer.