From c349035cd108bedf54e46e7cec538a5995293d9e Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 31 Jul 2022 12:10:43 +0200 Subject: [PATCH] Fix face memleak. --- code/AssetLib/Obj/ObjFileParser.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/Obj/ObjFileParser.cpp b/code/AssetLib/Obj/ObjFileParser.cpp index 5ef3f7139..266640ae5 100644 --- a/code/AssetLib/Obj/ObjFileParser.cpp +++ b/code/AssetLib/Obj/ObjFileParser.cpp @@ -433,7 +433,6 @@ void ObjFileParser::getFace(aiPrimitiveType type) { return; } - //ObjFile::Face *face = new ObjFile::Face(type); ObjFile::Face *face = new ObjFile::Face(type); bool hasNormal = false; @@ -501,7 +500,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) { } } else { //On error, std::atoi will return 0 which is not a valid value - //delete face; + delete face; throw DeadlyImportError("OBJ: Invalid face index."); } } @@ -512,7 +511,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) { ASSIMP_LOG_ERROR("Obj: Ignoring empty face"); // skip line and clean up m_DataIt = skipLine(m_DataIt, m_DataItEnd, m_uiLine); - //delete face; + delete face; return; }