]> granicus.if.org Git - libevent/commitdiff
Move assert(ev) to before we use ev in EV_CLOSURE_EVENT_FINALIZE case
authorNick Mathewson <nickm@torproject.org>
Thu, 6 Mar 2014 15:09:03 +0000 (10:09 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 6 Mar 2014 15:09:03 +0000 (10:09 -0500)
Based on a patch from Harlan Stenn.

event.c

diff --git a/event.c b/event.c
index 0c1f4f92320674960f1873077a5f05a3425f8507..0c4b30b6236e90eab353f3fc7433cc8f51113490 100644 (file)
--- 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);