Merge pull request #3788 from BaldricS/SceneCombiner_Memory_Leaks

Fix: Removing double delete of texture items after MergeScene.
pull/3826/head^2
Kim Kulling 2021-05-01 11:07:34 +02:00 committed by GitHub
commit f538b96e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -359,7 +359,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
// generate the output texture list + an offset table for all texture indices
if (dest->mNumTextures) {
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumMaterials];
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumTextures];
cnt = 0;
for (unsigned int n = 0; n < src.size(); ++n) {
SceneHelper *cur = &src[n];
@ -638,6 +638,8 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
deleteMe->mMaterials = nullptr;
delete[] deleteMe->mAnimations;
deleteMe->mAnimations = nullptr;
delete[] deleteMe->mTextures;
deleteMe->mTextures = nullptr;
deleteMe->mRootNode = nullptr;