From 3c9e57fd73db479d66fc654fe4a7171dd6432fd8 Mon Sep 17 00:00:00 2001 From: Thiago Goulart Date: Fri, 4 Mar 2016 03:33:45 -0800 Subject: [PATCH] Fix memory leak in OBJ loader when a mesh has no faces. --- code/ObjFileImporter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index c812baf23..f5c727ec9 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -308,7 +308,11 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj if( !pObjMesh ) { return NULL; } - ai_assert( NULL != pObjMesh ); + + if( pObjMesh->m_Faces.empty() ) { + return NULL; + } + aiMesh* pMesh = new aiMesh; if( !pObjMesh->m_name.empty() ) { pMesh->mName.Set( pObjMesh->m_name );