Skip to content

Fix segfault due to leftover ztargetfocus when switching maps

Hanicef requested to merge Hanicef/SRB2:fix-segfault-leftover-ztargetfocus into next

Between map changes, the ticcmd_ztargetfocus variable was never cleared, so the reference to the target mobj became dangling. This could trigger a crash or memory corruption depending on where the memory was allocated in virtual memory. This patch fixes this by simply clears the target mobj before a map change, so no dangling reference is held when all objects are deallocated.

Fixes #1333

Merge request reports

Loading