leak: free construction materials

This commit is contained in:
Enno Rehling 2015-10-13 22:41:54 +02:00
parent 457465b4a2
commit 26f5b592bd
2 changed files with 8 additions and 2 deletions

View File

@ -94,7 +94,10 @@ void bt_register(building_type * type)
void free_buildingtype(void *ptr) {
building_type *btype = (building_type *)ptr;
free(btype->construction);
if (btype->construction) {
free(btype->construction->materials);
free(btype->construction);
}
free(btype->_name);
free(btype);
}

View File

@ -245,7 +245,10 @@ static void free_shiptype(void *ptr) {
ship_type *stype = (ship_type *)ptr;
free(stype->_name);
free(stype->coasts);
free(stype->construction);
if (stype->construction) {
free(stype->construction->materials);
free(stype->construction);
}
free(stype);
}