diff options
author | yexo <yexo@openttd.org> | 2010-02-12 16:42:29 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-02-12 16:42:29 +0000 |
commit | 7d5cfa58841d1fe68dfaa42901c8b230fa58a692 (patch) | |
tree | e84444c974e1c7463c80aa95673cf90939e4a406 /src | |
parent | dd1c72d39a317e5abd7641b3a86fbdbca3b86442 (diff) | |
download | openttd-7d5cfa58841d1fe68dfaa42901c8b230fa58a692.tar.xz |
(svn r19105) -Fix [FS#3614]: not all news data was properly freed when starting a new game
Diffstat (limited to 'src')
-rw-r--r-- | src/news_gui.cpp | 2 | ||||
-rw-r--r-- | src/news_type.h | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp index b959d52fd..9b2a5dcb5 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -723,8 +723,6 @@ static void DeleteNewsItem(NewsItem *ni) _latest_news = ni->prev; } - free(ni->free_data); - if (_current_news == ni) _current_news = ni->prev; _total_news--; delete ni; diff --git a/src/news_type.h b/src/news_type.h index 8fbd90454..418334c73 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -144,6 +144,11 @@ struct NewsItem { void *free_data; ///< Data to be freed when the news item has reached its end. + ~NewsItem() + { + free(this->free_data); + } + uint64 params[10]; }; |