forked from github/server
memory leak: at_keys had no dtor
This commit is contained in:
parent
7e98384542
commit
1920dde717
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue