[Bf-blender-cvs] [a3b4c3823ca] master: Fix T54966: mathutils.noise.voronoi Memory leak
Bastien Montagne
noreply at git.blender.org
Mon May 7 11:12:17 CEST 2018
Commit: a3b4c3823ca7e16e6414a1dc39454a18fddb8e77
Author: Bastien Montagne
Date: Mon May 7 11:07:11 2018 +0200
Branches: master
https://developer.blender.org/rBa3b4c3823ca7e16e6414a1dc39454a18fddb8e77
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! ;)
===================================================================
M source/blender/python/mathutils/mathutils_noise.c
===================================================================
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,
More information about the Bf-blender-cvs
mailing list