From cd978eaa93f208ceecffbce139e7f7750e81b02a Mon Sep 17 00:00:00 2001 From: amzn-sean <75276488+amzn-sean@users.noreply.github.com> Date: Thu, 22 Apr 2021 17:22:26 +0100 Subject: [PATCH] fix potential memory leak --- Gems/PhysX/Code/Source/PhysXCharacters/API/CharacterUtils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gems/PhysX/Code/Source/PhysXCharacters/API/CharacterUtils.cpp b/Gems/PhysX/Code/Source/PhysXCharacters/API/CharacterUtils.cpp index 1c91818eb5..75cf536403 100644 --- a/Gems/PhysX/Code/Source/PhysXCharacters/API/CharacterUtils.cpp +++ b/Gems/PhysX/Code/Source/PhysXCharacters/API/CharacterUtils.cpp @@ -184,6 +184,7 @@ namespace PhysX if (sceneInterface == nullptr) { AZ_Error("PhysX Ragdoll", false, "Unable to Create Ragdoll, Physics Scene Interface is missing."); + delete ragdoll; return nullptr; } @@ -206,6 +207,7 @@ namespace PhysX else { AZ_Error("PhysX Ragdoll", false, "Failed to create collider shape for ragdoll node %s", nodeConfig.m_debugName.c_str()); + delete ragdoll; return nullptr; } } @@ -287,6 +289,7 @@ namespace PhysX else { AZ_Error("PhysX Ragdoll", false, "Failed to create joint for node index %i.", nodeIndex); + delete ragdoll; return nullptr; } }