From 2700ba17c0c6d6c2bb47d4dd88f627eab748afed Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Sat, 8 Sep 2012 19:43:24 +0000 Subject: [PATCH] fix memory leak when calling initializePolyhedralFeatures Fixes Issue 623, thanks for the report/patch! --- .../CollisionShapes/btPolyhedralConvexShape.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp index 063e1d044..83b899136 100644 --- a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp +++ b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp @@ -31,6 +31,7 @@ btPolyhedralConvexShape::~btPolyhedralConvexShape() { if (m_polyhedron) { + m_polyhedron->~btConvexPolyhedron(); btAlignedFree(m_polyhedron); } } @@ -40,7 +41,10 @@ bool btPolyhedralConvexShape::initializePolyhedralFeatures() { if (m_polyhedron) + { + m_polyhedron->~btConvexPolyhedron(); btAlignedFree(m_polyhedron); + } void* mem = btAlignedAlloc(sizeof(btConvexPolyhedron),16); m_polyhedron = new (mem) btConvexPolyhedron;