diff --git a/src/attributes/key.c b/src/attributes/key.c index 2d43df504..3df55174d 100644 --- a/src/attributes/key.c +++ b/src/attributes/key.c @@ -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, diff --git a/src/tests.c b/src/tests.c index 69d4d4f2b..f8a0c2a7f 100644 --- a/src/tests.c +++ b/src/tests.c @@ -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); + (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); }