fix bad size for calloc.

This commit is contained in:
Enno Rehling 2015-09-11 12:25:28 +02:00
parent c707ff39b6
commit 43bac506a4
1 changed files with 1 additions and 1 deletions

View File

@ -230,7 +230,7 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
if (strcmp(child->string, "production") == 0) { if (strcmp(child->string, "production") == 0) {
cJSON *entry; cJSON *entry;
int n, size = cJSON_GetArraySize(child); int n, size = cJSON_GetArraySize(child);
ter->production = (terrain_production *)calloc(size + 1, sizeof(const item_type *)); ter->production = (terrain_production *)calloc(size + 1, sizeof(terrain_production));
ter->production[size].type = 0; ter->production[size].type = 0;
for (n = 0, entry = child->child; entry; entry = entry->next, ++n) { for (n = 0, entry = child->child; entry; entry = entry->next, ++n) {
ter->production[n].type = rt_get_or_create(entry->string); ter->production[n].type = rt_get_or_create(entry->string);