Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE case

Based on a patch from Harlan Stenn.
This commit is contained in:
Nick Mathewson 2014-03-06 10:09:03 -05:00
parent 8896a92b07
commit 980597215d

View File

@ -1583,9 +1583,10 @@ event_process_active_single_queue(struct event_base *base,
break;
case EV_CLOSURE_EVENT_FINALIZE:
case EV_CLOSURE_EVENT_FINALIZE_FREE: {
void (*evcb_evfinalize)(struct event *, void *) = ev->ev_evcallback.evcb_cb_union.evcb_evfinalize;
base->current_event = NULL;
void (*evcb_evfinalize)(struct event *, void *);
EVUTIL_ASSERT(ev != NULL);
base->current_event = NULL;
evcb_evfinalize = ev->ev_evcallback.evcb_cb_union.evcb_evfinalize;
EVUTIL_ASSERT((evcb->evcb_flags & EVLIST_FINALIZING));
EVBASE_RELEASE_LOCK(base, th_base_lock);
evcb_evfinalize(ev, ev->ev_arg);