From 0963eb35972e9f9a0475bb5746823614460b5acd Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 3 Jan 2019 17:41:21 -0800 Subject: [PATCH] malloc -> new --- examples/SharedMemory/PhysicsClientC_API.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index 2b2d4451c..f7c54f918 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -1343,7 +1343,7 @@ B3_SHARED_API int b3CreateCollisionShapeAddConcaveMesh(b3PhysicsClientHandle phy command->m_createUserShapeArgs.m_shapes[shapeIndex].m_numVertices = numVertices; int totalUploadSizeInBytes = numVertices * sizeof(double) *3 + numIndices * sizeof(int); - char* data = (char*)malloc(totalUploadSizeInBytes); + char* data = new char[totalUploadSizeInBytes]; double* vertexUpload = (double*)data; int* indexUpload = (int*)(data + numVertices*sizeof(double)*3); @@ -1363,7 +1363,7 @@ B3_SHARED_API int b3CreateCollisionShapeAddConcaveMesh(b3PhysicsClientHandle phy } command->m_createUserShapeArgs.m_numUserShapes++; cl->uploadBulletFileToSharedMemory(data, totalUploadSizeInBytes); - free(data); + delete [] data; return shapeIndex; } }