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
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2005-11-29 04:35:45 +0300
committerKen Hughes <khughes@pacific.edu>2005-11-29 04:35:45 +0300
commit0ae3fe59a3d8e38c165de5841e771f5887b68db5 (patch)
tree99b0a6b09f9b1cfc63ac3a40a1e5d0b3b9a9f42f /source/blender/python/api2_2x/Curve.c
parentc0e94f3063c3aae00ca1c67d658dd3eec1ecc9a3 (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/python/api2_2x/Curve.c')
-rw-r--r--source/blender/python/api2_2x/Curve.c27
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;