diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-05-09 06:18:51 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-05-09 06:18:51 +0400 |
commit | fe894790361c604bb0d2215073b060dae01df99b (patch) | |
tree | f4e612b413ae110514efbeb7fceb90283ed8554b /source/blender/python/api2_2x/NMesh.c | |
parent | a2d9c2b905f1c2b80e7e643a15bcb2df7fcb70b3 (diff) |
BPython:
- Manuel from MakeHuman reported a memory leak in NMesh_getVertsFromGroup, should be fixed now. A pylist was not being decref'ed.
Diffstat (limited to 'source/blender/python/api2_2x/NMesh.c')
-rw-r--r-- | source/blender/python/api2_2x/NMesh.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index ef68ae9694c..a77828cf9c0 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -2439,7 +2439,7 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args) float weight; int i, k, l1, l2, count; int num = 0; - PyObject* tempVertexList; + PyObject* tempVertexList = NULL; PyObject* vertexList; PyObject* listObject; int tempInt; @@ -2483,8 +2483,13 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args) if(nIndex == -1) return EXPP_ReturnPyObjError (PyExc_AttributeError, "no deform groups assigned to mesh"); + //temporary list tempVertexList = PyList_New(((Mesh*)object->data)->totvert); + if (tempVertexList == NULL) + return EXPP_ReturnPyObjError (PyExc_RuntimeError, + "getVertsFromGroup: can't create pylist!"); + count = 0; if (listObject == (void *)-2054456) //do entire group @@ -2559,6 +2564,8 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args) //only return what we need vertexList = PyList_GetSlice(tempVertexList, 0, count); + Py_DECREF(tempVertexList); + return (vertexList); } |