Przeglądaj źródła

[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.

---

This change was previously made in 785cca1bb43f9e6047cb566a910fcd0e3d49951f, as part of PR #3890, but was lost in a merge.
Jason C 4 lat temu
rodzic
commit
00b625a2ae
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      code/AssetLib/AMF/AMFImporter.cpp

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

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