# HG changeset patch # User smatz # Date 2010-09-06 18:20:07 # Node ID f2d805b29aac879fdbd0aab173fb695243f5506d # Parent 697c0cd0a696198e68112a0f05de5a4db149e949 (svn r20758) -Fix: when leaving the program, current newgrf config would leak, causing valgrind warnings diff --git a/src/newgrf.cpp b/src/newgrf.cpp --- 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 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -159,6 +159,7 @@ extern GRFLoadedFeatures _loaded_newgrf_ 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 --- 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(); }