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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-07 12:07:11 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-07 12:07:11 +0300
commita3b4c3823ca7e16e6414a1dc39454a18fddb8e77 (patch)
tree2671364a06240fe615b5e16416a143708e4641d1 /source/blender/python
parent9bd2e9104a05cd95c8397204cbc11e5943064b9d (diff)
Fix T54966: mathutils.noise.voronoi Memory leak
C code was not correctly handling release of temp data, not technically a memory leak, but indeed rather annoying bug! ;)
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/mathutils/mathutils_noise.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index 143e51ecfd8..1fb6d306f96 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -731,6 +731,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
{
PyObject *value;
PyObject *list;
+ PyObject *ret;
float vec[3];
float da[4], pa[12];
int dtype = 0;
@@ -749,10 +750,14 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
voronoi(vec[0], vec[1], vec[2], da, pa, me, dtype);
for (i = 0; i < 4; i++) {
- PyList_SET_ITEM(list, i, Vector_CreatePyObject(pa + 3 * i, 3, NULL));
+ PyObject *v = Vector_CreatePyObject(pa + 3 * i, 3, NULL);
+ PyList_SET_ITEM(list, i, v);
+ Py_DECREF(v);
}
- return Py_BuildValue("[[ffff]O]", da[0], da[1], da[2], da[3], list);
+ ret = Py_BuildValue("[[ffff]O]", da[0], da[1], da[2], da[3], list);
+ Py_DECREF(list);
+ return ret;
}
PyDoc_STRVAR(M_Noise_cell_doc,