Skip to content

Commit

Permalink
Fix memory allocation issue when destroying a ConvexMesh
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielChappuis committed Jun 6, 2024
1 parent 1c2b817 commit 85fbcf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Issue [#377](https://github.com/DanielChappuis/reactphysics3d/issues/377) Assert when destroying an empty PhysicsWorld
- Issue [#378](https://github.com/DanielChappuis/reactphysics3d/issues/378) Wrong raycasting result against the HeightFieldShape
- Issue [#387](https://github.com/DanielChappuis/reactphysics3d/issues/387) Fix memory allocation issue when destroying a ConvexMesh
- Fix crash within testbed application in raycasting scene
- Fix robustness issue with CapsuleShape vs CapsuleShape collision

Expand Down
4 changes: 2 additions & 2 deletions src/engine/PhysicsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ ConvexMesh* PhysicsCommon::createConvexMesh(const PolygonVertexArray& polygonVer
// If the mesh is not valid
if (!isValid) {
mesh->~ConvexMesh();
allocator.release(mesh, sizeof(ConvexMesh));
mMemoryManager.release(MemoryManager::AllocationType::Pool, mesh, sizeof(ConvexMesh));
return nullptr;
}

Expand Down Expand Up @@ -661,7 +661,7 @@ ConvexMesh* PhysicsCommon::createConvexMesh(const VertexArray& vertexArray, std:
// If the mesh is not valid
if (!isValid) {
mesh->~ConvexMesh();
allocator.release(mesh, sizeof(ConvexMesh));
mMemoryManager.release(MemoryManager::AllocationType::Pool, mesh, sizeof(ConvexMesh));
return nullptr;
}

Expand Down

0 comments on commit 85fbcf8

Please sign in to comment.