From 3b467b35a85153e9435a1fbcba2e9c1770c1192a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 Nov 2016 19:31:46 +1100 Subject: Fix T50029: BVHTree.FromPolygons memory leak --- source/blender/python/mathutils/mathutils_bvhtree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/python') diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index ff1761eb6d7..1eb8644a9a6 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -817,13 +817,14 @@ static PyObject *C_BVHTree_FromPolygons(PyObject *UNUSED(cls), PyObject *args, P PyErr_Format(PyExc_ValueError, "%s: index %d must be less than %d", error_prefix, plink->poly[j], coords_len); - - Py_DECREF(py_tricoords_fast); + /* decref below */ valid = false; break; } } + Py_DECREF(py_tricoords_fast); + if (py_tricoords_len >= 3) { tris_len += (py_tricoords_len - 2); } -- cgit v1.2.3