From 980597215d60abfc98bbdb1e1288dcf7db32aede Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 6 Mar 2014 10:09:03 -0500 Subject: [PATCH] Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE case Based on a patch from Harlan Stenn. --- event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index 0c1f4f92..0c4b30b6 100644 --- a/event.c +++ b/event.c @@ -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); -- 2.40.0