From 23864ad423c8be7a2a2d558e47baa8dc122d8de0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 30 Sep 2005 21:22:25 +0000 Subject: [PATCH] Try to hunt down a few more leaks svn:r5172 --- src/or/main.c | 3 ++- src/or/routerlist.c | 2 ++ src/or/routerparse.c | 8 ++------ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/or/main.c b/src/or/main.c index 836b585569..cbc3e6db2a 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1303,7 +1303,8 @@ static int tor_init(int argc, char *argv[]) { time_of_process_start = time(NULL); - closeable_connection_lst = smartlist_create(); + if (!closeable_connection_lst) + closeable_connection_lst = smartlist_create(); /* Initialize the history structures. */ rep_hist_init(); /* Initialize the service cache. */ diff --git a/src/or/routerlist.c b/src/or/routerlist.c index c37b95a435..ddd33e7e82 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -93,6 +93,8 @@ router_reload_networkstatus(void) tor_free(s); } }); + SMARTLIST_FOREACH(entries, char *, fn, tor_free(fn)); + smartlist_free(entries); networkstatus_list_clean(time(NULL)); routers_update_all_from_networkstatus(); return 0; diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 7665e2a705..313fcfd6aa 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -642,13 +642,11 @@ int router_parse_list_from_string(const char **s, smartlist_t *dest) { routerinfo_t *router; - smartlist_t *routers; const char *end; tor_assert(s); tor_assert(*s); - - routers = smartlist_create(); + tor_assert(dest); while (1) { *s = eat_whitespace(*s); @@ -670,11 +668,9 @@ router_parse_list_from_string(const char **s, smartlist_t *dest) continue; } - smartlist_add(routers, router); + smartlist_add(dest, router); } - smartlist_add_all(dest, routers); - return 0; }