forked from github/server
memory leaks: call test_cleanup, free strlist, free message
This commit is contained in:
parent
d264c454b8
commit
0facb386a8
3 changed files with 5 additions and 1 deletions
|
@ -132,6 +132,7 @@ static void test_get_set_param(CuTest * tc)
|
|||
CuAssertStrEquals(tc, "foo", get_param(par, "bar"));
|
||||
set_param(&par, "bar", NULL);
|
||||
CuAssertPtrEquals(tc, NULL, (void *)get_param(par, "bar"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_param_int(CuTest * tc)
|
||||
|
@ -143,6 +144,7 @@ static void test_param_int(CuTest * tc)
|
|||
set_param(&par, "bar", "42");
|
||||
CuAssertIntEquals(tc, 23, get_param_int(par, "foo", 0));
|
||||
CuAssertIntEquals(tc, 42, get_param_int(par, "bar", 0));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_param_flt(CuTest * tc)
|
||||
|
@ -154,6 +156,7 @@ static void test_param_flt(CuTest * tc)
|
|||
set_param(&par, "bar", "42.0");
|
||||
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);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_forbiddenid(CuTest *tc) {
|
||||
|
|
|
@ -165,6 +165,7 @@ static void test_sparagraph(CuTest *tc) {
|
|||
CuAssertPtrNotNull(tc, sp->next->next);
|
||||
CuAssertStrEquals(tc, "12345678", sp->next->next->s);
|
||||
CuAssertPtrEquals(tc, 0, sp->next->next->next);
|
||||
freestrlist(sp);
|
||||
}
|
||||
|
||||
static void test_cr_unit(CuTest *tc) {
|
||||
|
|
|
@ -70,7 +70,7 @@ static void test_magicresistance_building(CuTest *tc) {
|
|||
msg = c->type->curseinfo(b1, TYP_BUILDING, c, 1);
|
||||
CuAssertPtrNotNull(tc, msg);
|
||||
CuAssertStrEquals(tc, "curseinfo::magicresistance_building", test_get_messagetype(msg));
|
||||
|
||||
msg_release(msg);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue