From 953db2dcbce2b531ef0535a65dc6942664c7cfba Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Sat, 16 May 2009 03:06:14 +0200 Subject: [PATCH] Fixed some autotest memory leaks. --- autotest/test_inf.tcc | 7 +++++++ autotest/test_message.tcc | 13 ++++++++++++- src/usermanager.c | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/autotest/test_inf.tcc b/autotest/test_inf.tcc index 2bc16c5..bc31804 100644 --- a/autotest/test_inf.tcc +++ b/autotest/test_inf.tcc @@ -27,6 +27,13 @@ static void inf_create_hub() static void inf_destroy_hub() { /* FIXME */ + list_destroy(inf_hub->users->list); + acl_shutdown(inf_hub->acl); + free_config(inf_hub->config); + hub_free(inf_hub->users); + hub_free(inf_hub->acl); + hub_free(inf_hub->config); + hub_free(inf_hub); } diff --git a/autotest/test_message.tcc b/autotest/test_message.tcc index 72fd1c9..34bf7a1 100644 --- a/autotest/test_message.tcc +++ b/autotest/test_message.tcc @@ -17,6 +17,11 @@ static void create_test_user() g_user->id.sid = 1; } +EXO_TEST(adc_message_first, { + create_test_user(); + return g_user != 0; +}); + EXO_TEST(adc_message_parse_1, { struct adc_message* msg = adc_msg_create("IMSG Hello\\sWorld!"); int ok = msg != NULL; @@ -30,7 +35,6 @@ EXO_TEST(adc_message_parse_2, { }); EXO_TEST(adc_message_parse_3, { - create_test_user(); struct adc_message* msg = adc_msg_parse_verify(g_user, "BMSG AAAB Hello\\sWorld!", 23); int ok = msg != NULL; adc_msg_free(msg); @@ -536,3 +540,10 @@ EXO_TEST(adc_message_empty_3, { return ok; }); +EXO_TEST(adc_message_last, { + hub_free(g_user); + g_user = 0; + return g_user == 0; +}); + + diff --git a/src/usermanager.c b/src/usermanager.c index 740005c..c7ff669 100644 --- a/src/usermanager.c +++ b/src/usermanager.c @@ -165,6 +165,8 @@ int user_manager_remove(struct hub_info* hub, struct user* user) hub->users->shared_size -= user->limits.shared_size; hub->users->shared_files -= user->limits.shared_files; + user->hub = 0; + return 0; }