diff options
author | Erwin Coumans <erwin.coumans@gmail.com> | 2020-08-13 16:40:37 -0700 |
---|---|---|
committer | Erwin Coumans <erwin.coumans@gmail.com> | 2020-08-13 16:40:37 -0700 |
commit | 306245d68ba75f5d5c3d04eac9786a27b4914936 (patch) | |
tree | 8652fa42bd40a68ae71938279efb1fe5f7982263 | |
parent | ff229baf1eec63cccd413d9055376376ba52bd34 (diff) | |
download | bullet3-306245d68ba75f5d5c3d04eac9786a27b4914936.tar.gz |
fix potential memory leak in createMultiBody, reported by Fei Xia here (thanks for report/repro!)
https://github.com/bulletphysics/bullet3/issues/2898
-rw-r--r-- | examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index b9a890d57..3fb7052ae 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -2521,6 +2521,17 @@ struct ProgrammaticUrdfInterface : public URDFImporterInterface } } } + + //delete textures + for (int i = 0; i < textures.size(); i++) + { + B3_PROFILE("free textureData"); + if (!textures[i].m_isCached) + { + free(textures[i].textureData1); + } + } + return graphicsIndex; } |