mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 22:00:05 +00:00
fix memory leak in calculateInverseKinematics2, reported here:
https://github.com/bulletphysics/bullet3/issues/3228 Thanks jcoholich for the report and repro case!
This commit is contained in:
parent
375d7097e4
commit
10020baa71
@ -1,4 +1,4 @@
|
|||||||
//#include "D:/dev/visual leak detector/include/vld.h"
|
#include "D:/dev/visual leak detector/include/vld.h"
|
||||||
|
|
||||||
#include "../SharedMemory/PhysicsClientC_API.h"
|
#include "../SharedMemory/PhysicsClientC_API.h"
|
||||||
#include "../SharedMemory/PhysicsDirectC_API.h"
|
#include "../SharedMemory/PhysicsDirectC_API.h"
|
||||||
@ -11642,6 +11642,8 @@ static PyObject* pybullet_calculateInverseKinematics2(PyObject* self,
|
|||||||
free(upperLimits);
|
free(upperLimits);
|
||||||
free(jointRanges);
|
free(jointRanges);
|
||||||
free(restPoses);
|
free(restPoses);
|
||||||
|
free(positions);
|
||||||
|
free(indices);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -11762,12 +11764,16 @@ static PyObject* pybullet_calculateInverseKinematics2(PyObject* self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(ikOutPutJointPos);
|
free(ikOutPutJointPos);
|
||||||
|
free(positions);
|
||||||
|
free(indices);
|
||||||
return pylist;
|
return pylist;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PyErr_SetString(SpamError,
|
PyErr_SetString(SpamError,
|
||||||
"Error in calculateInverseKinematics");
|
"Error in calculateInverseKinematics");
|
||||||
|
free(positions);
|
||||||
|
free(indices);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11775,8 +11781,13 @@ static PyObject* pybullet_calculateInverseKinematics2(PyObject* self,
|
|||||||
{
|
{
|
||||||
PyErr_SetString(SpamError,
|
PyErr_SetString(SpamError,
|
||||||
"calculateInverseKinematics couldn't extract position vector3");
|
"calculateInverseKinematics couldn't extract position vector3");
|
||||||
|
free(positions);
|
||||||
|
free(indices);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(positions);
|
||||||
|
free(indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user