forked from github/server
fix bad size for calloc.
This commit is contained in:
parent
c707ff39b6
commit
43bac506a4
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue