]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add an assertion to tor_libevent_get_base()
authorNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:37:00 +0000 (12:37 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:37:00 +0000 (12:37 -0500)
Closes ticket 18241.

changes/assert_event_base [new file with mode: 0644]
src/common/compat_libevent.c

diff --git a/changes/assert_event_base b/changes/assert_event_base
new file mode 100644 (file)
index 0000000..b887795
--- /dev/null
@@ -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.
index 29e5c5f63cddb946744155dcb97f9115df9ea928..c367ee4edbe9682f3ef48e6f1d2bff77f1090f2f 100644 (file)
@@ -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;
 }