]> granicus.if.org Git - libevent/commitdiff
Add some assertions to please coverity.
authorNick Mathewson <nickm@torproject.org>
Tue, 6 Aug 2013 23:06:58 +0000 (19:06 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 6 Aug 2013 23:10:13 +0000 (19:10 -0400)
In event_process_active_single_queue, EVLIST_INIT must be set on any
event that uses one of the event-only closures, and so "ev" will be
set in those cases.  But coverity's worried here (CIDs numerous).  So
instead, just add the assertions that should make it happy.

event.c

diff --git a/event.c b/event.c
index e406bd6654e0d9f43bd9ba63693ebf58ca59e5b4..d3ebb14c2791de9e8c6e2bba9f0434b2adedab51 100644 (file)
--- a/event.c
+++ b/event.c
@@ -1519,12 +1519,15 @@ event_process_active_single_queue(struct event_base *base,
 
                switch (evcb->evcb_closure) {
                case EV_CLOSURE_EVENT_SIGNAL:
+                       EVUTIL_ASSERT(ev != NULL);
                        event_signal_closure(base, ev);
                        break;
                case EV_CLOSURE_EVENT_PERSIST:
+                       EVUTIL_ASSERT(ev != NULL);
                        event_persist_closure(base, ev);
                        break;
                case EV_CLOSURE_EVENT:
+                       EVUTIL_ASSERT(ev != NULL);
                        EVBASE_RELEASE_LOCK(base, th_base_lock);
                        (*ev->ev_callback)(
                                ev->ev_fd, ev->ev_res, ev->ev_arg);