forked from github/server
leak: free construction materials
This commit is contained in:
parent
457465b4a2
commit
26f5b592bd
2 changed files with 8 additions and 2 deletions
|
@ -94,7 +94,10 @@ void bt_register(building_type * type)
|
||||||
|
|
||||||
void free_buildingtype(void *ptr) {
|
void free_buildingtype(void *ptr) {
|
||||||
building_type *btype = (building_type *)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->_name);
|
||||||
free(btype);
|
free(btype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,10 @@ static void free_shiptype(void *ptr) {
|
||||||
ship_type *stype = (ship_type *)ptr;
|
ship_type *stype = (ship_type *)ptr;
|
||||||
free(stype->_name);
|
free(stype->_name);
|
||||||
free(stype->coasts);
|
free(stype->coasts);
|
||||||
free(stype->construction);
|
if (stype->construction) {
|
||||||
|
free(stype->construction->materials);
|
||||||
|
free(stype->construction);
|
||||||
|
}
|
||||||
free(stype);
|
free(stype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue