From cef3b6d8411a512ff7d439715fc44bf5d372d17c Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 16 Jan 2024 06:31:56 -0800 Subject: [PATCH] srb2::Dialogue::NewText: free word-wrapped string --- src/k_dialogue.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/k_dialogue.cpp b/src/k_dialogue.cpp index d3fbe82dd..538e6d7d8 100644 --- a/src/k_dialogue.cpp +++ b/src/k_dialogue.cpp @@ -218,18 +218,20 @@ void Dialogue::SetSpeaker(std::string name, patch_t *patch, UINT8 *colormap, sfx typewriter.voiceSfx = voice; } -void Dialogue::NewText(std::string newText) +void Dialogue::NewText(std::string rawText) { Init(); - newText = V_ScaledWordWrap( + char* newText = V_ScaledWordWrap( 290 << FRACBITS, FRACUNIT, FRACUNIT, FRACUNIT, 0, HU_FONT, - newText.c_str() + rawText.c_str() ); typewriter.NewText(newText); + + Z_Free(newText); } bool Dialogue::Active(void)