Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-05-09 06:18:51 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-05-09 06:18:51 +0400
commitfe894790361c604bb0d2215073b060dae01df99b (patch)
treef4e612b413ae110514efbeb7fceb90283ed8554b /source
parenta2d9c2b905f1c2b80e7e643a15bcb2df7fcb70b3 (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')
-rw-r--r--source/blender/python/api2_2x/NMesh.c9
-rw-r--r--source/blender/python/api2_2x/NMesh.h2
2 files changed, 9 insertions, 2 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);
}
diff --git a/source/blender/python/api2_2x/NMesh.h b/source/blender/python/api2_2x/NMesh.h
index 499f9428700..efaba2a9e17 100644
--- a/source/blender/python/api2_2x/NMesh.h
+++ b/source/blender/python/api2_2x/NMesh.h
@@ -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 */