浏览代码

Fix of a possible memory leak: ConcavePolygonShapeBullet::setup was able to exit without releasing the 'shapeInterface' pointer.

Alexander Alekseev 7 年之前
父节点
当前提交
b569251110
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      modules/bullet/shape_bullet.cpp

+ 2 - 2
modules/bullet/shape_bullet.cpp

@@ -337,10 +337,10 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
 	int src_face_count = faces.size();
 	if (0 < src_face_count) {
 
-		btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh);
-
 		// It counts the faces and assert the array contains the correct number of vertices.
 		ERR_FAIL_COND(src_face_count % 3);
+
+		btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh);
 		src_face_count /= 3;
 		PoolVector<Vector3>::Read r = p_faces.read();
 		const Vector3 *facesr = r.ptr();