From: Nick Mathewson Date: Thu, 4 Feb 2016 17:37:00 +0000 (-0500) Subject: Add an assertion to tor_libevent_get_base() X-Git-Tag: tor-0.2.8.2-alpha~121^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c595f6d25e9cda58f5327c5806e2c9a534c454f9;p=thirdparty%2Ftor.git Add an assertion to tor_libevent_get_base() Closes ticket 18241. --- diff --git a/changes/assert_event_base b/changes/assert_event_base new file mode 100644 index 0000000000..b887795518 --- /dev/null +++ b/changes/assert_event_base @@ -0,0 +1,5 @@ + o Minor features (robustness): + - Exit immediately with an error message if the code attempts to + use libevent without having initialized it. This should resolve + some frequently-made mistakes in our unit tests. Closes ticket + 18241. diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 29e5c5f63c..c367ee4edb 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -247,6 +247,7 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg) MOCK_IMPL(struct event_base *, tor_libevent_get_base, (void)) { + tor_assert(the_event_base != NULL); return the_event_base; }