summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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];
};