diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-05-24 17:13:15 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-05-24 17:13:15 +0000 |
commit | d2cdae221d5ec8757b47ada8d1ee5f225586425c (patch) | |
tree | b329ea438f9081134f4b6dfa9e338c7e4b129685 /src/or/main.c | |
parent | 619224317dcf663aea892a0a98ef0934a901200d (diff) | |
download | tor-d2cdae221d5ec8757b47ada8d1ee5f225586425c.tar.gz tor-d2cdae221d5ec8757b47ada8d1ee5f225586425c.zip |
Fix not-freed-on-exit event
svn:r4298
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c index 92e26e5cf9..d2f4cc3926 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -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. */ |