summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 24d9727ff..583b4773b 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -465,12 +465,13 @@ static void Save_NGRF(void)
static void Load_NGRF(void)
{
- GRFConfig *c = CallocT<GRFConfig>(1);
+ GRFConfig c;
+ memset(&c, 0, sizeof(GRFConfig));
+
while (SlIterateArray() != -1) {
- SlObject(c, _grfconfig_desc);
- AppendToGRFConfigList(&_grfconfig, c);
+ SlObject(&c, _grfconfig_desc);
+ AppendToGRFConfigList(&_grfconfig, &c);
}
- free(c);
/* Append static NewGRF configuration */
AppendStaticGRFConfigs(&_grfconfig);