diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-11-29 04:35:45 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-11-29 04:35:45 +0300 |
commit | 0ae3fe59a3d8e38c165de5841e771f5887b68db5 (patch) | |
tree | 99b0a6b09f9b1cfc63ac3a40a1e5d0b3b9a9f42f /source/blender | |
parent | c0e94f3063c3aae00ca1c67d658dd3eec1ecc9a3 (diff) |
-- Partial bugfix for #3186. curve.getControlPoint() wasn't DECREF-ing
values added to a list, causing a memory leak.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/api2_2x/Curve.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 544ae9fb00a..2445e835dee 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -838,6 +838,7 @@ static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args ) static PyObject *Curve_getControlPoint( BPy_Curve * self, PyObject * args ) { PyObject *liste = PyList_New( 0 ); /* return values */ + PyObject *item; Nurb *ptrnurb; int i, j; @@ -870,22 +871,18 @@ static PyObject *Curve_getControlPoint( BPy_Curve * self, PyObject * args ) "point index out of range" ) ); if( ptrnurb->bp ) { /* if we are a nurb curve, you get 4 values */ - for( i = 0; i < 4; i++ ) - PyList_Append( liste, - PyFloat_FromDouble( ptrnurb-> - bp[numpoint]. - vec[i] ) ); - } - - if( ptrnurb->bezt ) { /* if we are a bezier, you get 9 values */ + for( i = 0; i < 4; i++ ) { + item = PyFloat_FromDouble( ptrnurb->bp[numpoint].vec[i] ); + PyList_Append( liste, item ); + Py_DECREF(item); + } + } else if( ptrnurb->bezt ) { /* if we are a bezier, you get 9 values */ for( i = 0; i < 3; i++ ) - for( j = 0; j < 3; j++ ) - PyList_Append( liste, - PyFloat_FromDouble( ptrnurb-> - bezt - [numpoint]. - vec[i] - [j] ) ); + for( j = 0; j < 3; j++ ) { + item = PyFloat_FromDouble( ptrnurb->bezt[numpoint].vec[i][j] ); + PyList_Append( liste, item ); + Py_DECREF(item); + } } return liste; |