122243,122194 Resource leak

This commit is contained in:
wise86Android
2016-09-24 16:27:40 +02:00
parent 61097479c8
commit 3f53ffa576
2 changed files with 11 additions and 8 deletions

View File

@@ -172,8 +172,7 @@ void MDLImporter::InternReadFile( const std::string& pFile,
}
// Allocate storage and copy the contents of the file to a memory buffer
std::vector<unsigned char> buffer(iFileSize+1);
mBuffer = &buffer[0];
mBuffer =new unsigned char[iFileSize+1];
file->Read( (void*)mBuffer, 1, iFileSize);
// Append a binary zero to the end of the buffer.
@@ -239,7 +238,8 @@ void MDLImporter::InternReadFile( const std::string& pFile,
0.f,0.f,1.f,0.f,0.f,-1.f,0.f,0.f,0.f,0.f,0.f,1.f);
// delete the file buffer and cleanup
AI_DEBUG_INVALIDATE_PTR(mBuffer);
delete [] mBuffer;
mBuffer= nullptr;
AI_DEBUG_INVALIDATE_PTR(pIOHandler);
AI_DEBUG_INVALIDATE_PTR(pScene);
}