fixed memory leak in 3ds loader when splitting mesh buffers, reported by Dave

git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@738 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
bitplane 2007-06-27 18:11:23 +00:00
parent 7c13125362
commit d821c6dd4a

View File

@ -936,11 +936,13 @@ void C3DSMeshFileLoader::composeObject(io::IReadFile* file, const core::stringc&
{
u32 vtxCount = mb->Vertices.size();
if (vtxCount>maxPrimitives)
{
Mesh->addMeshBuffer(new SMeshBuffer());
{
IMeshBuffer* tmp = mb;
mb=(SMeshBuffer*)(Mesh->MeshBuffers[mbPos]=Mesh->MeshBuffers.getLast());
Mesh->MeshBuffers[Mesh->MeshBuffers.size()-1]=tmp;
mb = new SMeshBuffer();
Mesh->addMeshBuffer(mb);
mb->drop();
Mesh->MeshBuffers[mbPos] = Mesh->MeshBuffers.getLast();
Mesh->MeshBuffers[Mesh->MeshBuffers.size()-1] = tmp;
mb->getMaterial() = *mat;
vtxCount=0;
}