From 8a505398a3a735763a1babbc7e08ae14d0eafd20 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 2 Jan 2018 20:35:06 +0200 Subject: [PATCH] MMD: Fix memory leak --- code/MMDImporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/MMDImporter.cpp b/code/MMDImporter.cpp index 5d4bd137a..76ad9115c 100644 --- a/code/MMDImporter.cpp +++ b/code/MMDImporter.cpp @@ -168,7 +168,7 @@ void MMDImporter::CreateDataFromImport(const pmx::PmxModel *pModel, } // create node hierarchy for bone position - aiNode **ppNode = new aiNode *[pModel->bone_count]; + std::unique_ptr ppNode(new aiNode *[pModel->bone_count]); for (auto i = 0; i < pModel->bone_count; i++) { ppNode[i] = new aiNode(pModel->bones[i].bone_name); } @@ -177,9 +177,9 @@ void MMDImporter::CreateDataFromImport(const pmx::PmxModel *pModel, const pmx::PmxBone &bone = pModel->bones[i]; if (bone.parent_index < 0) { - pScene->mRootNode->addChildren(1, ppNode + i); + pScene->mRootNode->addChildren(1, ppNode.get() + i); } else { - ppNode[bone.parent_index]->addChildren(1, ppNode + i); + ppNode[bone.parent_index]->addChildren(1, ppNode.get() + i); aiVector3D v3 = aiVector3D( bone.position[0] - pModel->bones[bone.parent_index].position[0],