From 31771e5856a78c0cc8a6396d39ad94b44d2c61fd Mon Sep 17 00:00:00 2001 From: SashaXser <24498484+SashaXser@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:39:12 +0400 Subject: [PATCH] Fix code scanning alert no. 96: Potential use after free Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- redalert/unit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redalert/unit.cpp b/redalert/unit.cpp index 06762f51..37eb0a28 100644 --- a/redalert/unit.cpp +++ b/redalert/unit.cpp @@ -4400,8 +4400,10 @@ BulletClass* UnitClass::Fire_At(TARGET target, int which) if (bullet != NULL) { #ifdef FIXIT_CSII // checked - ajw 9/28/98 - if (Class->Type == UNIT_DEMOTRUCK && IsActive) + if (Class->Type == UNIT_DEMOTRUCK && IsActive) { delete this; + return NULL; + } #endif /* ** Possible reload timer set.