PyBullet: fix some file leaks.

This commit is contained in:
Erwin Coumans 2018-12-04 19:37:25 +01:00
parent a23cfd0782
commit d4db50f668
3 changed files with 4 additions and 2 deletions

View File

@ -141,6 +141,7 @@ bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string&
buffer.resize(0);
}
}
fileIO->fileClose(fileId);
}
if (buffer.size())

View File

@ -10244,6 +10244,7 @@ bool PhysicsServerCommandProcessor::processLoadTextureCommand(const struct Share
buffer.resize(0);
}
}
fileIO->fileClose(fileId);
}
if (buffer.size())
{

View File

@ -579,7 +579,7 @@ std::string LoadMtl(
// flush last material.
material_map.insert(std::pair<std::string, material_t>(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);
}