[Bf-blender-cvs] [9755986] master: BGE: Fix memory leak when unable to add wheel

Jorge Bernal noreply at git.blender.org
Fri May 29 17:04:07 CEST 2015


Commit: 9755986637a52f81147b3f89802748aacdffa20d
Author: Jorge Bernal
Date:   Fri May 29 17:01:05 2015 +0200
Branches: master
https://developer.blender.org/rB9755986637a52f81147b3f89802748aacdffa20d

BGE: Fix memory leak when unable to add wheel

===================================================================

M	source/gameengine/Ketsji/KX_VehicleWrapper.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index 237f485..b422007 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -87,8 +87,6 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args)
 
 		if (gameOb->GetSGNode())
 		{
-			PHY_IMotionState* motionState = new KX_MotionState(gameOb->GetSGNode());
-			
 			MT_Vector3 attachPos,attachDir,attachAxle;
 			if(!PyVecTo(pylistPos,attachPos)) {
 				PyErr_SetString(PyExc_AttributeError,
@@ -115,6 +113,7 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args)
 				return NULL;
 			}
 
+			PHY_IMotionState *motionState = new KX_MotionState(gameOb->GetSGNode());
 			m_vehicle->AddWheel(motionState,attachPos,attachDir,attachAxle,suspensionRestLength,wheelRadius,hasSteering);
 		}




More information about the Bf-blender-cvs mailing list