浏览代码

[amf] Fix crash when file could not be parsed.

Fix double free of mXmlParser (deleted but not reset in ParseFile, then deleted again in ~AMFImporter).

Should probably use a smart pointer instead, though.

Partially addresses https://github.com/assimp/assimp/issues/3888.
Jason C 4 年之前
父节点
当前提交
785cca1bb4
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      code/AssetLib/AMF/AMFImporter.cpp

+ 1 - 0
code/AssetLib/AMF/AMFImporter.cpp

@@ -268,6 +268,7 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
     mXmlParser = new XmlParser();
     if (!mXmlParser->parse(file.get())) {
         delete mXmlParser;
+        mXmlParser = nullptr;
         throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
     }