summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2010-09-06 18:20:07 +0000
committersmatz <smatz@openttd.org>2010-09-06 18:20:07 +0000
commit82949024f18811120bfc35da04fbd4b22f7f1d45 (patch)
treec271f75b712da1f93b67c2d3ea315ca5d9399d31
parenta71cc228b250d4ba95fc2a0fd4957957811a60dd (diff)
downloadopenttd-82949024f18811120bfc35da04fbd4b22f7f1d45.tar.xz
(svn r20758) -Fix: when leaving the program, current newgrf config would leak, causing valgrind warnings
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/newgrf.h1
-rw-r--r--src/openttd.cpp3
3 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index d26e8973d..b902929e5 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -6984,7 +6984,7 @@ static void ResetNewGRFErrors()
* Reset all NewGRF loaded data
* TODO
*/
-static void ResetNewGRFData()
+void ResetNewGRFData()
{
CleanUpStrings();
CleanUpGRFTownNames();
diff --git a/src/newgrf.h b/src/newgrf.h
index 58202ed25..eb4e8b298 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -159,6 +159,7 @@ extern GRFLoadedFeatures _loaded_newgrf_features;
void LoadNewGRFFile(struct GRFConfig *config, uint file_index, GrfLoadingStage stage);
void LoadNewGRF(uint load_index, uint file_index);
void ReloadNewGRFData(); // in saveload/afterload.cpp
+void ResetNewGRFData();
void CDECL grfmsg(int severity, const char *str, ...) WARN_FORMAT(2, 3);
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 25387f41c..e4f85a302 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -59,6 +59,7 @@
#include "rail_gui.h"
#include "core/backup_type.hpp"
#include "hotkeys.h"
+#include "newgrf.h"
#include "town.h"
@@ -347,6 +348,8 @@ static void ShutdownGame()
free(_config_file);
#endif
+ ResetNewGRFData();
+
/* Close all and any open filehandles */
FioCloseAll();
}