memory leaks: call test_cleanup, free strlist, free message

This commit is contained in:
Enno Rehling 2015-10-13 22:21:05 +02:00
parent d264c454b8
commit 0facb386a8
3 changed files with 5 additions and 1 deletions

View File

@ -132,6 +132,7 @@ static void test_get_set_param(CuTest * tc)
CuAssertStrEquals(tc, "foo", get_param(par, "bar")); CuAssertStrEquals(tc, "foo", get_param(par, "bar"));
set_param(&par, "bar", NULL); set_param(&par, "bar", NULL);
CuAssertPtrEquals(tc, NULL, (void *)get_param(par, "bar")); CuAssertPtrEquals(tc, NULL, (void *)get_param(par, "bar"));
test_cleanup();
} }
static void test_param_int(CuTest * tc) static void test_param_int(CuTest * tc)
@ -143,6 +144,7 @@ static void test_param_int(CuTest * tc)
set_param(&par, "bar", "42"); set_param(&par, "bar", "42");
CuAssertIntEquals(tc, 23, get_param_int(par, "foo", 0)); CuAssertIntEquals(tc, 23, get_param_int(par, "foo", 0));
CuAssertIntEquals(tc, 42, get_param_int(par, "bar", 0)); CuAssertIntEquals(tc, 42, get_param_int(par, "bar", 0));
test_cleanup();
} }
static void test_param_flt(CuTest * tc) static void test_param_flt(CuTest * tc)
@ -154,6 +156,7 @@ static void test_param_flt(CuTest * tc)
set_param(&par, "bar", "42.0"); set_param(&par, "bar", "42.0");
CuAssertDblEquals(tc, 23.0, get_param_flt(par, "foo", 0.0), 0.01); CuAssertDblEquals(tc, 23.0, get_param_flt(par, "foo", 0.0), 0.01);
CuAssertDblEquals(tc, 42.0, get_param_flt(par, "bar", 0.0), 0.01); CuAssertDblEquals(tc, 42.0, get_param_flt(par, "bar", 0.0), 0.01);
test_cleanup();
} }
static void test_forbiddenid(CuTest *tc) { static void test_forbiddenid(CuTest *tc) {

View File

@ -165,6 +165,7 @@ static void test_sparagraph(CuTest *tc) {
CuAssertPtrNotNull(tc, sp->next->next); CuAssertPtrNotNull(tc, sp->next->next);
CuAssertStrEquals(tc, "12345678", sp->next->next->s); CuAssertStrEquals(tc, "12345678", sp->next->next->s);
CuAssertPtrEquals(tc, 0, sp->next->next->next); CuAssertPtrEquals(tc, 0, sp->next->next->next);
freestrlist(sp);
} }
static void test_cr_unit(CuTest *tc) { static void test_cr_unit(CuTest *tc) {

View File

@ -70,7 +70,7 @@ static void test_magicresistance_building(CuTest *tc) {
msg = c->type->curseinfo(b1, TYP_BUILDING, c, 1); msg = c->type->curseinfo(b1, TYP_BUILDING, c, 1);
CuAssertPtrNotNull(tc, msg); CuAssertPtrNotNull(tc, msg);
CuAssertStrEquals(tc, "curseinfo::magicresistance_building", test_get_messagetype(msg)); CuAssertStrEquals(tc, "curseinfo::magicresistance_building", test_get_messagetype(msg));
msg_release(msg);
test_cleanup(); test_cleanup();
} }