some drmemory fixes

some tests leaked.
current test_eressea reports:
     41 unique,    41 total,   3778 byte(s) of leak(s)
    120 unique,   270 total,   5615 byte(s) of possible leak(s)
This commit is contained in:
Enno Rehling 2016-02-25 10:16:50 +01:00
parent db852a05fd
commit 5fed36903c
3 changed files with 3 additions and 5 deletions

View File

@ -30,8 +30,8 @@ static void test_group_readwrite(CuTest * tc)
gamedata *data; gamedata *data;
test_cleanup(); test_cleanup();
test_create_world();
data = gamedata_open("test.dat", "wb", RELEASE_VERSION); data = gamedata_open("test.dat", "wb", RELEASE_VERSION);
CuAssertPtrNotNull(tc, data);
f = test_create_faction(0); f = test_create_faction(0);
g = new_group(f, "NW", 42); g = new_group(f, "NW", 42);
g = new_group(f, "Egoisten", 43); g = new_group(f, "Egoisten", 43);

View File

@ -35,8 +35,6 @@ static void test_ship_not_allowed_in_coast(CuTest * tc)
ship_type *stype; ship_type *stype;
test_cleanup(); test_cleanup();
test_create_world();
ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO); ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO);
otype = test_create_terrain("ocean", SEA_REGION | SAIL_INTO); otype = test_create_terrain("ocean", SEA_REGION | SAIL_INTO);
stype = test_create_shiptype("derp"); stype = test_create_shiptype("derp");
@ -50,6 +48,7 @@ static void test_ship_not_allowed_in_coast(CuTest * tc)
CuAssertIntEquals(tc, SA_NO_COAST, check_ship_allowed(sh, r1)); CuAssertIntEquals(tc, SA_NO_COAST, check_ship_allowed(sh, r1));
stype->coasts[0] = ttype; stype->coasts[0] = ttype;
CuAssertIntEquals(tc, SA_COAST, check_ship_allowed(sh, r1)); CuAssertIntEquals(tc, SA_COAST, check_ship_allowed(sh, r1));
test_cleanup();
} }
typedef struct move_fixture { typedef struct move_fixture {
@ -68,7 +67,6 @@ static void setup_harbor(move_fixture *mf) {
unit *u; unit *u;
test_cleanup(); test_cleanup();
test_create_world();
ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO); ttype = test_create_terrain("glacier", LAND_REGION | ARCTIC_REGION | WALK_INTO | SAIL_INTO);
btype = test_create_buildingtype("harbour"); btype = test_create_buildingtype("harbour");

View File

@ -156,7 +156,7 @@ ship_type * test_create_shiptype(const char * name)
stype->coasts = stype->coasts =
(terrain_type **)malloc(sizeof(terrain_type *)*2); (terrain_type **)malloc(sizeof(terrain_type *)*2);
stype->coasts[0] = get_or_create_terrain("plain"); stype->coasts[0] = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO);
stype->coasts[1] = NULL; stype->coasts[1] = NULL;
if (default_locale) { if (default_locale) {