From 0648916c4a5a501dee0a4af616362ed52e3691bc Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 2 Feb 2026 16:11:41 +0100 Subject: [PATCH] plug a potential memory leak in M_SaveConfig --- src/hu_stuff.c | 15 +++++++++++---- src/m_misc.cpp | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index ae6a86135..8d702151a 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1332,6 +1332,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) x = 0; } } + return newstring; } @@ -1370,7 +1371,7 @@ static void HU_drawMiniChat(void) emote_t *emote = NULL; int emotelen = 0; - while(msg[j]) // iterate through msg + while (msg[j]) // iterate through msg { if (msg[j] < HU_FONTSTART) // don't draw { @@ -1402,14 +1403,17 @@ static void HU_drawMiniChat(void) { j++; } + prev_linereturn = false; dx += charwidth; + if (dx >= boxw) { dx = 0; linescount += 1; } } + dy = 0; dx = 0; msglines += linescount+1; @@ -1449,7 +1453,7 @@ static void HU_drawMiniChat(void) emote_t *emote = NULL; int emotelen = 0; - while(msg[j]) // iterate through msg + while (msg[j]) // iterate through msg { if (msg[j] < HU_FONTSTART) // don't draw { @@ -1494,12 +1498,14 @@ static void HU_drawMiniChat(void) dx += charwidth; prev_linereturn = false; + if (dx >= boxw) { dx = 0; dy += charheight; } } + dy += charheight; dx = 0; @@ -1558,7 +1564,7 @@ static void HU_drawChatLog(INT32 offset) V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 159|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box - for (i=0; i