From 5bec41ad1666f95c268fed30d71612571e38aeeb Mon Sep 17 00:00:00 2001 From: wise86Android Date: Sat, 24 Sep 2016 20:11:07 +0200 Subject: [PATCH] 122198 Resource leak --- code/NDOLoader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/NDOLoader.cpp b/code/NDOLoader.cpp index f04eb5345..de682e260 100644 --- a/code/NDOLoader.cpp +++ b/code/NDOLoader.cpp @@ -257,7 +257,8 @@ void NDOImporter::InternReadFile( const std::string& pFile, } aiMesh* mesh = new aiMesh(); - aiFace* faces = mesh->mFaces = new aiFace[mesh->mNumFaces=face_table.size()]; + mesh->mNumFaces=face_table.size(); + aiFace* faces = mesh->mFaces = new aiFace[mesh->mNumFaces]; vertices.clear(); vertices.reserve(4 * face_table.size()); // arbitrarily chosen @@ -298,7 +299,8 @@ void NDOImporter::InternReadFile( const std::string& pFile, pScene->mMeshes[pScene->mNumMeshes] = mesh; (nd->mMeshes = new unsigned int[nd->mNumMeshes=1])[0]=pScene->mNumMeshes++; - } + }else + delete mesh; } }