fix some memory leaks

This commit is contained in:
Enno Rehling 2017-03-30 23:13:55 +02:00
parent 4115b321b3
commit c49786d713
6 changed files with 14 additions and 4 deletions

2
cJSON

@ -1 +1 @@
Subproject commit 22a4fc9be31f0426e622f5bc9ebd7a1550845001
Subproject commit 43c04ad61258ec3d54a2167eb3a43915bd003ab1

@ -1 +1 @@
Subproject commit 540abd0adef2e173b2433a4d8b6c49af7ca675ad
Subproject commit ecf956b9808c28c2db52e6b73930f57876dbb258

View File

@ -323,6 +323,7 @@ static void test_newbie_password_message(CuTest *tc) {
prepare_report(&ctx, f);
CuAssertIntEquals(tc, FFL_PWMSG, f->flags&FFL_PWMSG);
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "changepasswd"));
finish_reports(&ctx);
test_cleanup();
}
@ -359,6 +360,7 @@ static void test_prepare_travelthru(CuTest *tc) {
CuAssertPtrEquals(tc, f2, ctx.f);
CuAssertPtrEquals(tc, r1, ctx.first);
CuAssertPtrEquals(tc, NULL, ctx.last);
finish_reports(&ctx);
test_cleanup();
}
@ -384,6 +386,7 @@ static void test_get_addresses(CuTest *tc) {
CuAssertTrue(tc, selist_contains(ctx.addresses, f1, NULL));
CuAssertTrue(tc, selist_contains(ctx.addresses, f2, NULL));
CuAssertIntEquals(tc, 3, selist_length(ctx.addresses));
finish_reports(&ctx);
test_cleanup();
}
@ -411,6 +414,7 @@ static void test_get_addresses_fstealth(CuTest *tc) {
CuAssertTrue(tc, !selist_contains(ctx.addresses, f1, NULL));
CuAssertTrue(tc, selist_contains(ctx.addresses, f2, NULL));
CuAssertIntEquals(tc, 2, selist_length(ctx.addresses));
finish_reports(&ctx);
test_cleanup();
}
@ -441,6 +445,7 @@ static void test_get_addresses_travelthru(CuTest *tc) {
CuAssertTrue(tc, !selist_contains(ctx.addresses, f1, NULL));
CuAssertTrue(tc, selist_contains(ctx.addresses, f2, NULL));
CuAssertIntEquals(tc, 2, selist_length(ctx.addresses));
finish_reports(&ctx);
test_cleanup();
}
@ -523,6 +528,7 @@ static void test_prepare_lighthouse(CuTest *tc) {
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
CuAssertIntEquals(tc, seen_neighbour, r3->seen.mode);
finish_reports(&ctx);
test_cleanup();
}
@ -560,6 +566,7 @@ static void test_prepare_lighthouse_owners(CuTest *tc) {
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
CuAssertIntEquals(tc, seen_neighbour, r3->seen.mode);
finish_reports(&ctx);
test_cleanup();
}
@ -585,7 +592,6 @@ static void test_prepare_report(CuTest *tc) {
CuAssertIntEquals(tc, seen_unit, r->seen.mode);
finish_reports(&ctx);
CuAssertIntEquals(tc, seen_none, r->seen.mode);
finish_reports(&ctx);
r = test_create_region(2, 0, 0);
CuAssertPtrEquals(tc, r, regions->next);
@ -593,6 +599,7 @@ static void test_prepare_report(CuTest *tc) {
CuAssertPtrEquals(tc, regions, ctx.first);
CuAssertPtrEquals(tc, r, ctx.last);
CuAssertIntEquals(tc, seen_none, r->seen.mode);
finish_reports(&ctx);
test_cleanup();
}

View File

@ -163,6 +163,8 @@ static void init_learning(struct attrib *a)
static void done_learning(struct attrib *a)
{
teaching_info *teach = (teaching_info *)a->data.v;
selist_free(teach->teachers);
free(a->data.v);
}

View File

@ -127,6 +127,7 @@ static void test_attrib_rwstring(CuTest *tc) {
data.strm.api->rewind(data.strm.handle);
a_readstring(&a, NULL, &data);
CuAssertStrEquals(tc, "Hello World", (const char *)a.data.v);
a_finalizestring(&a);
mstream_done(&data.strm);
gamedata_done(&data);
test_cleanup();

@ -1 +1 @@
Subproject commit d807ef5ce64b3425b31fb440e0b93a4d233f517a
Subproject commit 2117191d4ad75e1eb14809878bc71d15b20a5d86