diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-07-31 08:41:27 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-07-31 08:45:17 -0400 |
commit | a67d153cc7493f918f93d2ddb9aa62a27b434e5e (patch) | |
tree | 1816944edf2e58e2e4bf4f38396cb9ca39c93e2f | |
parent | 373b23a9ee80eb81a0d4db9fb6b742a602c8e82d (diff) | |
download | tor-a67d153cc7493f918f93d2ddb9aa62a27b434e5e.tar.gz tor-a67d153cc7493f918f93d2ddb9aa62a27b434e5e.zip |
Always call tor_free_all() when exiting tor_run_main()
We would usually call it through tor_cleanup(), but in some code
paths, we wouldn't. These paths would break restart-in-process,
since leaving fields uncleared would cause assertion failures on
restart.
Fixes bug 26948; bugfix on 0.3.3.1-alpha
-rw-r--r-- | changes/bug26948 | 4 | ||||
-rw-r--r-- | src/or/main.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/changes/bug26948 b/changes/bug26948 new file mode 100644 index 0000000000..0f0728843f --- /dev/null +++ b/changes/bug26948 @@ -0,0 +1,4 @@ + o Minor bugfixes (in-process restart): + - Always call tor_free_all() when leaving tor_run_main(). When we + did not, restarting tor in-process would cause an assertion failure. + Fixes bug 26948; bugfix on 0.3.3.1-alpha. diff --git a/src/or/main.c b/src/or/main.c index 7f07b44044..9ecdc95552 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -4035,10 +4035,10 @@ tor_run_main(const tor_main_configuration_t *tor_cfg) #endif /* defined(NT_SERVICE) */ { int init_rv = tor_init(argc, argv); - if (init_rv < 0) - return -1; - else if (init_rv > 0) - return 0; + if (init_rv) { + tor_free_all(0); + return (init_rv < 0) ? -1 : 0; + } } if (get_options()->Sandbox && get_options()->command == CMD_RUN_TOR) { @@ -4046,6 +4046,7 @@ tor_run_main(const tor_main_configuration_t *tor_cfg) if (sandbox_init(cfg)) { log_err(LD_BUG,"Failed to create syscall sandbox filter"); + tor_free_all(0); return -1; } |