[Bf-blender-cvs] [3b467b3] master: Fix T50029: BVHTree.FromPolygons memory leak

Campbell Barton noreply at git.blender.org
Tue Nov 29 09:14:17 CET 2016


Commit: 3b467b35a85153e9435a1fbcba2e9c1770c1192a
Author: Campbell Barton
Date:   Tue Nov 29 19:31:46 2016 +1100
Branches: master
https://developer.blender.org/rB3b467b35a85153e9435a1fbcba2e9c1770c1192a

Fix T50029: BVHTree.FromPolygons memory leak

===================================================================

M	source/blender/python/mathutils/mathutils_bvhtree.c

===================================================================

diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c
index ff1761e..1eb8644 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);
 			}




More information about the Bf-blender-cvs mailing list