Fixed some autotest memory leaks.

This commit is contained in:
Jan Vidar Krey 2009-05-16 03:06:14 +02:00
parent 6e4ac1355f
commit 953db2dcbc
3 changed files with 21 additions and 1 deletions

View File

@ -27,6 +27,13 @@ static void inf_create_hub()
static void inf_destroy_hub() static void inf_destroy_hub()
{ {
/* FIXME */ /* 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);
} }

View File

@ -17,6 +17,11 @@ static void create_test_user()
g_user->id.sid = 1; g_user->id.sid = 1;
} }
EXO_TEST(adc_message_first, {
create_test_user();
return g_user != 0;
});
EXO_TEST(adc_message_parse_1, { EXO_TEST(adc_message_parse_1, {
struct adc_message* msg = adc_msg_create("IMSG Hello\\sWorld!"); struct adc_message* msg = adc_msg_create("IMSG Hello\\sWorld!");
int ok = msg != NULL; int ok = msg != NULL;
@ -30,7 +35,6 @@ EXO_TEST(adc_message_parse_2, {
}); });
EXO_TEST(adc_message_parse_3, { EXO_TEST(adc_message_parse_3, {
create_test_user();
struct adc_message* msg = adc_msg_parse_verify(g_user, "BMSG AAAB Hello\\sWorld!", 23); struct adc_message* msg = adc_msg_parse_verify(g_user, "BMSG AAAB Hello\\sWorld!", 23);
int ok = msg != NULL; int ok = msg != NULL;
adc_msg_free(msg); adc_msg_free(msg);
@ -536,3 +540,10 @@ EXO_TEST(adc_message_empty_3, {
return ok; return ok;
}); });
EXO_TEST(adc_message_last, {
hub_free(g_user);
g_user = 0;
return g_user == 0;
});

View File

@ -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_size -= user->limits.shared_size;
hub->users->shared_files -= user->limits.shared_files; hub->users->shared_files -= user->limits.shared_files;
user->hub = 0;
return 0; return 0;
} }