summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-07 14:30:30 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-07 14:30:30 -0400
commit8b1380cbd08f40dc2abee171a390df6d04e999d1 (patch)
tree37665a3c2b0d4b31bc6991b1678ea7f9bd14ff1a /src/or/main.c
parent17236a58429dab6bf0536a64b90c4ec7f25985b8 (diff)
downloadtor-8b1380cbd08f40dc2abee171a390df6d04e999d1.tar.gz
tor-8b1380cbd08f40dc2abee171a390df6d04e999d1.zip
Don't crash when closing a connection before initializing libevent
Fixes bug 25981; bugfix on 96c5ac338a7df. Bug not in any released version of Tor.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index c3505a2d91..87b57f89e3 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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);
}