forked from github/server
do not leak terrain.herbs
This commit is contained in:
parent
c04bda102b
commit
b5455531e7
|
@ -270,6 +270,7 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
|
|||
int size = cJSON_GetArraySize(child);
|
||||
if (size > 0) {
|
||||
int n;
|
||||
free(ter->herbs);
|
||||
ter->herbs = malloc(sizeof(const item_type *) * (size + 1));
|
||||
ter->herbs[size] = 0;
|
||||
for (n = 0, entry = child->child; entry; entry = entry->next) {
|
||||
|
|
|
@ -63,6 +63,7 @@ void free_terrains(void)
|
|||
terrain_type * t = registered_terrains;
|
||||
registered_terrains = t->next;
|
||||
free(t->_name);
|
||||
free(t->herbs);
|
||||
if (t->production) {
|
||||
for (n = 0; t->production[n].type; ++n) {
|
||||
free(t->production[n].base);
|
||||
|
|
Loading…
Reference in New Issue