summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
commitf95d7c189bb89474c57dc9b60832df70fe57760f (patch)
treed000c451f9ec0ef25217dcd6b75463182087d19d /src/or/main.c
parent6c432a5565183b705569310a34b4da54b1bf98d4 (diff)
downloadtor-f95d7c189bb89474c57dc9b60832df70fe57760f.tar.gz
tor-f95d7c189bb89474c57dc9b60832df70fe57760f.zip
Refactor unit test macros and tor_free_all() logic a bit so as to make it easier to free memory on failing tests, in order to suppress scanner warnings and to make dmalloc() usable with tests.
svn:r16816
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index a4bc71ef65..a44b427740 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -244,6 +244,8 @@ connection_in_array(connection_t *conn)
smartlist_t *
get_connection_array(void)
{
+ if (!connection_array)
+ connection_array = smartlist_create();
return connection_array;
}
@@ -1951,9 +1953,12 @@ tor_free_all(int postfork)
tor_tls_free_all();
}
/* stuff in main.c */
- smartlist_free(connection_array);
- smartlist_free(closeable_connection_lst);
- smartlist_free(active_linked_connection_lst);
+ if (connection_array)
+ smartlist_free(connection_array);
+ if (closeable_connection_lst)
+ smartlist_free(closeable_connection_lst);
+ if (active_linked_connection_lst)
+ smartlist_free(active_linked_connection_lst);
tor_free(timeout_event);
/* Stuff in util.c and address.c*/
if (!postfork) {