From d4db50f66850d7f87bad9b8c8612816f00a4e1cb Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Tue, 4 Dec 2018 19:37:25 +0100 Subject: [PATCH] PyBullet: fix some file leaks. --- examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp | 1 + examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 1 + examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp b/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp index 5f553bcbe..b4e02243d 100644 --- a/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp +++ b/examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp @@ -141,6 +141,7 @@ bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string& buffer.resize(0); } } + fileIO->fileClose(fileId); } if (buffer.size()) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index db69fa956..54329ec27 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -10244,6 +10244,7 @@ bool PhysicsServerCommandProcessor::processLoadTextureCommand(const struct Share buffer.resize(0); } } + fileIO->fileClose(fileId); } if (buffer.size()) { diff --git a/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp b/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp index 115cde02a..9cd2f2092 100644 --- a/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp +++ b/examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp @@ -579,7 +579,7 @@ std::string LoadMtl( // flush last material. material_map.insert(std::pair(material.name, material)); - if (fileHandle) + if (fileHandle>=0) { fileIO->fileClose(fileHandle); } @@ -858,7 +858,7 @@ LoadObj( } faceGroup.resize(0); // for safety - if (fileHandle) + if (fileHandle>=0) { fileIO->fileClose(fileHandle); }