- Manuel from MakeHuman reported a memory leak in NMesh_getVertsFromGroup, should be fixed now.  A pylist was not being decref'ed.
This commit is contained in:
2004-05-09 02:18:51 +00:00
parent a2d9c2b905
commit fe89479036
2 changed files with 9 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -261,7 +261,7 @@ typedef struct {
float no[3];
float uvco[3];
int index;
char flag; /* see MVert flag in DNA_mesh_types */
char flag; /* see MVert flag in DNA_meshdata_types */
} BPy_NMVert; /* an NMesh vertex */