From 82e33fd4e4e73a91b59eab3df9cb748dd20c0d52 Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 17 Jul 2024 12:30:34 +0300 Subject: [PATCH] Attempt to fix possible use-after-free for awayviewmobj --- src/g_game.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index d1a3106ae..a8146014f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4388,6 +4388,11 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool players[i].starpostx = players[i].starposty = players[i].starpostz = 0; players[i].lives = 1; // SRB2Kart + // This should be cleared in P_SpawnPlayer but address sanitizer says "use-after-free" + // when reloading map sometimes + players[i].awayviewtics = 0; + players[i].awayviewmobj = NULL; + // The latter two should clear by themselves, but just in case players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);