mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Fix not-freed-on-exit event
svn:r4298
This commit is contained in:
parent
619224317d
commit
d2cdae221d
@ -768,10 +768,11 @@ static void run_scheduled_events(time_t now) {
|
||||
close_closeable_connections();
|
||||
}
|
||||
|
||||
static struct event *timeout_event = NULL;
|
||||
|
||||
/** Libevent callback: invoked once every second. */
|
||||
static void second_elapsed_callback(int fd, short event, void *args)
|
||||
{
|
||||
static struct event *timeout_event = NULL;
|
||||
static struct timeval one_second;
|
||||
static long current_second = 0;
|
||||
struct timeval now;
|
||||
@ -780,7 +781,6 @@ static void second_elapsed_callback(int fd, short event, void *args)
|
||||
int seconds_elapsed;
|
||||
or_options_t *options = get_options();
|
||||
if (!timeout_event) {
|
||||
/* XXX NM: We don't free timeout_event on exit. */
|
||||
timeout_event = tor_malloc_zero(sizeof(struct event));
|
||||
evtimer_set(timeout_event, second_elapsed_callback, NULL);
|
||||
one_second.tv_sec = 1;
|
||||
@ -1251,6 +1251,7 @@ void tor_free_all(int postfork)
|
||||
tor_tls_free_all();
|
||||
/* stuff in main.c */
|
||||
smartlist_free(closeable_connection_lst);
|
||||
tor_free(timeout_event);
|
||||
|
||||
if (!postfork) {
|
||||
close_logs(); /* free log strings. do this last so logs keep working. */
|
||||
|
Loading…
Reference in New Issue
Block a user