From 3cfc6f787cc2985703d925917a0b986de80e5f4d Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 11 Jun 2016 02:06:24 -0500 Subject: [PATCH 1/2] Adds some pointer cleanup in the event we bail out of creating a new object for whatever reason. --- Engine/source/console/compiledEval.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index a989826b43..88556cb468 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -902,6 +902,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi // Fail to create the object. delete object; + currentNewObject = NULL; ip = failJump; break; } @@ -1016,6 +1017,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip), currentNewObject->getName(), errorStr.c_str()); dataBlock->deleteObject(); + currentNewObject = NULL; ip = failJump; // Prevent stack value corruption From 810ac82eaee5e11c24236ebf499ac8ebfb1fb0d8 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 20 Jun 2016 12:34:07 -0500 Subject: [PATCH 2/2] Adds a missed cleanup for currentNewObj. --- Engine/source/console/compiledEval.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 88556cb468..d61a8f3531 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -871,6 +871,7 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi { Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", getFileLine(ip), (const char*)callArgv[1]); delete object; + currentNewObject = NULL; ip = failJump; break; }