mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Call tor_free_all instead of connections_free_all after forking
svn:r4173
This commit is contained in:
+1
-1
@@ -214,7 +214,7 @@ static int cpuworker_main(void *data) {
|
||||
fd = fdarray[1]; /* this side is ours */
|
||||
#ifndef TOR_IS_MULTITHREADED
|
||||
tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
|
||||
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
|
||||
tor_free_all(1); /* so the child doesn't hold the parent's fd's open */
|
||||
handle_signals(0); /* ignore interrupts from the keyboard, etc */
|
||||
#endif
|
||||
tor_free(data);
|
||||
|
||||
+1
-1
@@ -721,7 +721,7 @@ static int dnsworker_main(void *data) {
|
||||
fd = fdarray[1]; /* this side is ours */
|
||||
#ifndef TOR_IS_MULTITHREADED
|
||||
tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
|
||||
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
|
||||
connection_free_all(1); /* so the child doesn't hold the parent's fd's open */
|
||||
handle_signals(0); /* ignore interrupts from the keyboard, etc */
|
||||
#endif
|
||||
tor_free(data);
|
||||
|
||||
+9
-6
@@ -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();
|
||||
|
||||
@@ -1543,6 +1543,7 @@ void directory_has_arrived(time_t now, char *identity_digest);
|
||||
int control_signal_act(int the_signal);
|
||||
void handle_signals(int is_parent);
|
||||
void tor_cleanup(void);
|
||||
void tor_free_all(int postfork);
|
||||
|
||||
int tor_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user