aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-05-03 03:51:20 +0000
committerNick Mathewson <nickm@torproject.org>2005-05-03 03:51:20 +0000
commitb35f7dacef6b5e4215dfba9a4088a73421fb103c (patch)
tree567d49d6244c5c07160931458b644450b25b8ce5 /src/or/main.c
parent8b9ae2522409f09584d60619fc39b421560a715e (diff)
downloadtor-b35f7dacef6b5e4215dfba9a4088a73421fb103c.tar.gz
tor-b35f7dacef6b5e4215dfba9a4088a73421fb103c.zip
Call tor_free_all instead of connections_free_all after forking
svn:r4173
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 12e8536aad..1dbc396589 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -40,7 +40,6 @@ static void conn_write_callback(int fd, short event, void *_conn);
static void signal_callback(int fd, short events, void *arg);
static void second_elapsed_callback(int fd, short event, void *args);
static int conn_close_if_marked(int i);
-void tor_free_all(void);
/********* START VARIABLES **********/
@@ -1227,7 +1226,7 @@ static int tor_init(int argc, char *argv[]) {
*
* Also valgrind should then report 0 reachable in its
* leak report */
-void tor_free_all(void)
+void tor_free_all(int postfork)
{
routerlist_free_current();
free_trusted_dir_servers();
@@ -1242,13 +1241,17 @@ void tor_free_all(void)
clear_pending_onions();
circuit_free_all();
connection_free_all();
- config_free_all();
- router_free_all_keys();
+ if (!postfork) {
+ config_free_all();
+ router_free_all_keys();
+ }
tor_tls_free_all();
/* stuff in main.c */
smartlist_free(closeable_connection_lst);
- close_logs(); /* free log strings. do this last so logs keep working. */
+ if (!postfork) {
+ close_logs(); /* free log strings. do this last so logs keep working. */
+ }
}
/** Do whatever cleanup is necessary before shutting Tor down. */
@@ -1260,7 +1263,7 @@ void tor_cleanup(void) {
unlink(options->PidFile);
if (accounting_is_enabled(options))
accounting_record_bandwidth_usage(time(NULL));
- tor_free_all(); /* move tor_free_all back into the ifdef below later. XXX*/
+ tor_free_all(0); /* move tor_free_all back into the ifdef below later. XXX*/
crypto_global_cleanup();
#ifdef USE_DMALLOC
dmalloc_log_unfreed();