From 82949024f18811120bfc35da04fbd4b22f7f1d45 Mon Sep 17 00:00:00 2001 From: smatz Date: Mon, 6 Sep 2010 18:20:07 +0000 Subject: (svn r20758) -Fix: when leaving the program, current newgrf config would leak, causing valgrind warnings --- src/newgrf.cpp | 2 +- src/newgrf.h | 1 + src/openttd.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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(); } -- cgit v1.2.3-70-g09d2