diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-28 01:33:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-28 01:33:48 +0400 |
commit | bcc314311969959df482dd5525703533d875d023 (patch) | |
tree | 5e5a622471e0214b3ba481ba503ecee1cfa6b06c /source/blender/python/api2_2x/NMesh.c | |
parent | d9e85385fd083ef11ccc4ffa06f9120599f18510 (diff) |
more memory leak fixes, though only a few are likely to happen
Diffstat (limited to 'source/blender/python/api2_2x/NMesh.c')
-rw-r--r-- | source/blender/python/api2_2x/NMesh.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index 0eb90d348ce..5c86a344896 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -533,10 +533,12 @@ static PyObject *new_NMFace( PyObject * vertexlist ) if( item ) PyList_SET_ITEM( vlcopy, i, item ); - else + else { + Py_DECREF(vlcopy); return EXPP_ReturnPyObjError ( PyExc_RuntimeError, "couldn't get vertex from a PyList" ); + } } } else /* create an empty vertex list */ vlcopy = PyList_New( 0 ); @@ -3808,14 +3810,16 @@ static PyObject *NMesh_assignVertsToGroup( PyObject * self, PyObject * args ) if( ! ( PyArg_Parse ( ( PyList_GetItem( listObject, x ) ), "i", - &tempInt ) ) ) + &tempInt ) ) ) { return EXPP_ReturnPyObjError( PyExc_TypeError, "python list integer not parseable" ); + } if( tempInt < 0 - || tempInt >= ( ( Mesh * ) object->data )->totvert ) + || tempInt >= ( ( Mesh * ) object->data )->totvert ) { return EXPP_ReturnPyObjError( PyExc_ValueError, "bad vertex index in list" ); + } add_vert_defnr( object, nIndex, tempInt, weight, assignmode ); } @@ -4013,16 +4017,18 @@ static PyObject *NMesh_getVertsFromGroup( PyObject * self, PyObject * args ) if( ! ( PyArg_Parse ( ( PyList_GetItem( listObject, x ) ), "i", - &tempInt ) ) ) + &tempInt ) ) ) { + Py_DECREF(tempVertexList); return EXPP_ReturnPyObjError( PyExc_TypeError, "python list integer not parseable" ); - + } if( tempInt < 0 || tempInt >= - ( ( Mesh * ) object->data )->totvert ) + ( ( Mesh * ) object->data )->totvert ) { + Py_DECREF(tempVertexList); return EXPP_ReturnPyObjError( PyExc_ValueError, "bad vertex index in list" ); - + } num = tempInt; dvert = ( ( Mesh * ) object->data )->dvert + num; for( i = 0; i < dvert->totweight; i++ ) { |