aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug306296
-rw-r--r--src/app/main/shutdown.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/changes/bug30629 b/changes/bug30629
new file mode 100644
index 0000000000..59fa96ee68
--- /dev/null
+++ b/changes/bug30629
@@ -0,0 +1,6 @@
+ o Minor bugfixes (shutdown, libevent, memory safety):
+ - Avoid use-after-free bugs when shutting down, by making sure that we
+ shut down libevent only after shutting down all of its users. We
+ believe these are harmless in practice, since they only occur on the
+ shutdown path, and do not involve any attacker-controlled data. Fixes
+ bug 30629; bugfix on 0.4.1.1-alpha.
diff --git a/src/app/main/shutdown.c b/src/app/main/shutdown.c
index e4dcaa1324..cc0091a9ab 100644
--- a/src/app/main/shutdown.c
+++ b/src/app/main/shutdown.c
@@ -157,10 +157,11 @@ tor_free_all(int postfork)
if (!postfork) {
release_lockfile();
}
- tor_libevent_free_all();
subsystems_shutdown();
+ tor_libevent_free_all();
+
/* Stuff in util.c and address.c*/
if (!postfork) {
esc_router_info(NULL);