]> granicus.if.org Git - libevent/commit
Fix crash bugs when a bufferevent's eventcb is not set.
authorNick Mathewson <nickm@torproject.org>
Wed, 30 Dec 2009 00:50:03 +0000 (19:50 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 30 Dec 2009 00:50:03 +0000 (19:50 -0500)
commit2e8eeea3e86b1f577e34ef2bc4f7099d848ae787
tree045ebf8a1765c21cc6240c400136b0f1be27c422
parent0b151a9fa1365ad9f6f2e58fcfcfb36840707403
Fix crash bugs when a bufferevent's eventcb is not set.

In many places throughout the code, we called _bufferevent_run_eventcb
without checking whether the eventcb was actually set.  This would
work fine when the bufferevent's callbacks were deferred, but
otherwise the code would segfault.  Strangely, we always remembered to
check before calling the _bufferevent_run_{read,write}cb functions.

To prevent similar errors in the future, all of
_buferevent_run_{read,write,event}cb now check to make sure the
callback is actually set before invoking or deferring the callback.
This patch also removes the now-redundant checks for {read,write}cb.
bufferevent.c
bufferevent_async.c
bufferevent_filter.c
bufferevent_openssl.c
bufferevent_pair.c
bufferevent_sock.c