From c44522d4db95f685db0cedd2f0b85102f152b623 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 19 Dec 2017 19:38:38 +0200 Subject: [PATCH] ObjImporter: Fix possible memory leak --- code/ObjFileImporter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 5fa57e108..e1a084d62 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -264,8 +264,12 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile { unsigned int meshId = pObject->m_Meshes[ i ]; aiMesh *pMesh = createTopology( pModel, pObject, meshId ); - if( pMesh && pMesh->mNumFaces > 0 ) { - MeshArray.push_back( pMesh ); + if( pMesh ) { + if (pMesh->mNumFaces > 0) { + MeshArray.push_back( pMesh ); + } else { + delete pMesh; + } } }