Explorar o código

Fix memory leak in case of an error.

Kim Kulling %!s(int64=8) %!d(string=hai) anos
pai
achega
c9ada44ab5
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      code/ObjFileParser.cpp

+ 2 - 0
code/ObjFileParser.cpp

@@ -477,6 +477,8 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
                 }
                 }
             } else {
             } else {
                 //On error, std::atoi will return 0 which is not a valid value
                 //On error, std::atoi will return 0 which is not a valid value
+                delete m_pModel;
+                m_pModel = nullptr;
                 throw DeadlyImportError("OBJ: Invalid face indice");
                 throw DeadlyImportError("OBJ: Invalid face indice");
             }
             }