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:
authorCampbell Barton <ideasman42@gmail.com>2015-07-29 02:49:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-07-29 03:49:35 +0300
commit96f08bf9a8e0cfcbbc774c3c00c58d405e3dc55c (patch)
tree5c501fe681b6f4dcb22130eb3bce4ce263c578f3 /source/blender/python/mathutils/mathutils.c
parent376e4c945ee862bb7cd7d22d677a5e59b8eeeb36 (diff)
Fix leaks in mathutils PySequence_Fast usage
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r--source/blender/python/mathutils/mathutils.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 8b18a02a186..4a2d9cfe99b 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -70,12 +70,10 @@ static int mathutils_array_parse_fast(float *array,
"%.200s: sequence index %d expected a number, "
"found '%.200s' type, ",
error_prefix, i, Py_TYPE(item)->tp_name);
- Py_DECREF(value_fast);
return -1;
}
} while (i);
- Py_XDECREF(value_fast);
return size;
}
@@ -182,6 +180,7 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
}
size = mathutils_array_parse_fast(array, size, value_fast, error_prefix);
+ Py_DECREF(value_fast);
}
if (size != -1) {
@@ -239,6 +238,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
size = PySequence_Fast_GET_SIZE(value_fast);
if (size < array_min) {
+ Py_DECREF(value_fast);
PyErr_Format(PyExc_ValueError,
"%.200s: sequence size is %d, expected > %d",
error_prefix, size, array_min);
@@ -248,6 +248,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
*array = PyMem_Malloc(size * sizeof(float));
ret = mathutils_array_parse_fast(*array, size, value_fast, error_prefix);
+ Py_DECREF(value_fast);
if (ret == -1) {
PyMem_Free(*array);