[tor-commits] [tor/master] Don't crash when closing a connection before initializing libevent

nickm at torproject.org nickm at torproject.org
Thu May 10 23:31:36 UTC 2018


commit 8b1380cbd08f40dc2abee171a390df6d04e999d1
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon May 7 14:30:30 2018 -0400

    Don't crash when closing a connection before initializing libevent
    
    Fixes bug 25981; bugfix on 96c5ac338a7df.  Bug not in any released
    version of Tor.
---
 src/or/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/or/main.c b/src/or/main.c
index c3505a2d9..87b57f89e 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);
 }
 





More information about the tor-commits mailing list