summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-12 16:42:29 +0000
committeryexo <yexo@openttd.org>2010-02-12 16:42:29 +0000
commit7d5cfa58841d1fe68dfaa42901c8b230fa58a692 (patch)
treee84444c974e1c7463c80aa95673cf90939e4a406 /src
parentdd1c72d39a317e5abd7641b3a86fbdbca3b86442 (diff)
downloadopenttd-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.cpp2
-rw-r--r--src/news_type.h5
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];
};