From 54d7f064208744dd091680d31fb1ea3b8fda7345 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 31 Mar 2024 12:29:12 +0100 Subject: [PATCH] V_ScaledWordWrap allocates Zone memory, so be sure to free Goner's usage --- src/menus/main-goner.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/menus/main-goner.cpp b/src/menus/main-goner.cpp index 107b9c652..29618a7eb 100644 --- a/src/menus/main-goner.cpp +++ b/src/menus/main-goner.cpp @@ -16,6 +16,7 @@ #include "../m_easing.h" #include "../g_input.h" #include "../m_pw.h" +#include "../z_zone.h" #include @@ -136,16 +137,20 @@ public: GonerChatLine(gonerspeakers_t speaker, int delay, std::string dialogue) { - this->speaker = speaker; - this->dialogue = V_ScaledWordWrap( + char *newText = V_ScaledWordWrap( (BASEVIDWIDTH/2 + 6) << FRACBITS, FRACUNIT, FRACUNIT, FRACUNIT, 0, TINY_FONT, dialogue.c_str() ); + + this->speaker = speaker; + this->dialogue = std::string(newText); this->value = delay; this->routine = nullptr; + + Z_Free(newText); }; GonerChatLine(int delay, void (*routine)(void))