Fix leak in BMesh convex hull operator
authorCampbell Barton <ideasman42@gmail.com>
Sat, 30 May 2015 06:17:04 +0000 (16:17 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 30 May 2015 06:17:04 +0000 (16:17 +1000)
extern/bullet2/src/Bullet-C-Api.h
extern/bullet2/src/BulletDynamics/Dynamics/Bullet-C-API.cpp
source/blender/bmesh/operators/bmo_hull.c

index 2eabf3840e1a00ae11d234590568afc9c1d267b7..5d00f7e3ac3b701aa94769055fe61c3f87840507 100644 (file)
@@ -171,6 +171,7 @@ extern "C" {
        /* Convex Hull */
        PL_DECLARE_HANDLE(plConvexHull);
        plConvexHull plConvexHullCompute(float (*coords)[3], int count);
+       void plConvexHullDelete(plConvexHull hull);
        int plConvexHullNumVertices(plConvexHull hull);
        int plConvexHullNumFaces(plConvexHull hull);
        void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
index 21f0aa93220d95c71803e22dd97482c59b37e1f3..e1f69afe1012e087a3bf8aced5fb5ffbb5cf7225 100644 (file)
@@ -413,6 +413,12 @@ plConvexHull plConvexHullCompute(float (*coords)[3], int count)
        return reinterpret_cast<plConvexHull>(computer);
 }
 
+void plConvexHullDelete(plConvexHull hull)
+{
+       btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
+       delete computer;
+}
+
 int plConvexHullNumVertices(plConvexHull hull)
 {
        btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
index fe4a0204335025edc8ee05d1d30c5c4bd8c1bdaf..2dfad5a1f47fd0f9e9696f9290ede13da59f6895 100644 (file)
@@ -537,6 +537,9 @@ static void hull_from_bullet(
        }
 
        BLI_array_free(fvi);
+
+       plConvexHullDelete(hull);
+
        MEM_freeN(hull_verts);
        MEM_freeN(coords);
        MEM_freeN(input_verts);