memory leak: at_keys had no dtor

This commit is contained in:
Enno Rehling 2016-03-10 21:54:53 +01:00
parent 7e98384542
commit 1920dde717
2 changed files with 9 additions and 3 deletions

View File

@ -53,10 +53,14 @@ static int a_readkey(attrib *a, void *owner, struct gamedata *data) {
return (res != AT_READ_FAIL) ? AT_READ_DEPR : res;
}
static void a_freekeys(attrib *a) {
free(a->data.v);
}
attrib_type at_keys = {
"keys",
NULL,
NULL,
a_freekeys,
NULL,
a_writekeys,
a_readkeys,

View File

@ -154,11 +154,13 @@ ship_type * test_create_shiptype(const char * name)
stype->construction->skill = SK_SHIPBUILDING;
}
if (stype->coasts) {
free(stype->coasts);
}
stype->coasts =
(terrain_type **)malloc(sizeof(terrain_type *) * 2);
stype->coasts[0] = test_create_terrain("plain", LAND_REGION | FOREST_REGION | WALK_INTO | CAVALRY_REGION | SAIL_INTO | FLY_INTO);
stype->coasts[1] = NULL;
if (default_locale) {
locale_setstring(default_locale, name, name);
}