]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't crash when closing a connection before initializing libevent
authorNick Mathewson <nickm@torproject.org>
Mon, 7 May 2018 18:30:30 +0000 (14:30 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 7 May 2018 18:30:30 +0000 (14:30 -0400)
Fixes bug 25981; bugfix on 96c5ac338a7df.  Bug not in any released
version of Tor.

src/or/main.c

index c3505a2d9161ca89ff062ae302aeb1e2145d0f31..87b57f89e37e1c34d5465a06a1767bf5aae9aeb8 100644 (file)
@@ -1676,6 +1676,11 @@ static mainloop_event_t *postloop_cleanup_ev=NULL;
 void
 mainloop_schedule_postloop_cleanup(void)
 {
+  if (PREDICT_UNLIKELY(postloop_cleanup_ev == NULL)) {
+    // (It's possible that we can get here if we decide to close a connection
+    // in the earliest stages of our configuration, before we create events.)
+    return;
+  }
   mainloop_event_activate(postloop_cleanup_ev);
 }