From 2455ae9218ac5865d8477e4c19ddf55ecd6a1dc9 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.c | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e9aaac430..77d9d7fbe 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1483,6 +1483,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) x = 0; } } + return newstring; } @@ -1521,7 +1522,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 { @@ -1553,14 +1554,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; @@ -1596,7 +1600,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 { @@ -1641,12 +1645,14 @@ static void HU_drawMiniChat(void) dx += charwidth; prev_linereturn = false; + if (dx >= boxw) { dx = 0; dy += charheight; } } + dy += charheight; dx = 0; Z_Free(msg); @@ -1701,7 +1707,7 @@ static void HU_drawChatLog(INT32 offset) V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box - for (i=0; i