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:
authorStephen Swaney <sswaney@centurytel.net>2004-10-15 03:11:09 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-10-15 03:11:09 +0400
commit8edf8ff5fadbf78fb0caf02d31811d2c7b2d651b (patch)
tree357467509948224c483c72809643b3fae9af9bad /source/blender/python/api2_2x/matrix.c
parent634648699586cf409e19cfeb4bd405647cf4c698 (diff)
bugfix: #1642 Matrix multiplication memory leak
another memory leak plugged.
Diffstat (limited to 'source/blender/python/api2_2x/matrix.c')
-rw-r--r--source/blender/python/api2_2x/matrix.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/matrix.c b/source/blender/python/api2_2x/matrix.c
index 8f5e2794062..ef137731a78 100644
--- a/source/blender/python/api2_2x/matrix.c
+++ b/source/blender/python/api2_2x/matrix.c
@@ -754,7 +754,8 @@ PyObject *Matrix_sub( PyObject * m1, PyObject * m2 )
PyObject *Matrix_mul( PyObject * m1, PyObject * m2 )
{
- float *mat;
+ float *mat = NULL;
+ PyObject *retval;;
int matSizeV, rowSizeV, colSizeV, rowSizeW, colSizeW, matSizeW, x, y,
z;
float dot = 0;
@@ -795,7 +796,9 @@ PyObject *Matrix_mul( PyObject * m1, PyObject * m2 )
matW->matrix[x][y];
}
}
- return newMatrixObject( mat, rowSizeV, colSizeV );
+ retval = ( PyObject* ) newMatrixObject( mat, rowSizeV, colSizeV );
+ PyMem_Free( mat );
+ return retval;
} else if( matW->flag == 0 && matV->flag == 0 ) { //true matrix multiplication
if( colSizeV != rowSizeW ) {
return EXPP_ReturnPyObjError( PyExc_AttributeError,
@@ -818,7 +821,9 @@ PyObject *Matrix_mul( PyObject * m1, PyObject * m2 )
dot = 0;
}
}
- return newMatrixObject( mat, rowSizeV, colSizeW );
+ retval = ( PyObject* ) newMatrixObject( mat, rowSizeV, colSizeW );
+ PyMem_Free( mat );
+ return retval;
} else
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"Error in matrix_mul...\n" );