[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 785cca1bb4, as part of PR #3890, but was lost in a merge.
pull/3898/head
Jason C 2021-05-10 19:01:15 -04:00 committed by Jason C
parent 7ff6144c2c
commit 00b625a2ae
1 changed files with 2 additions and 1 deletions

View File

@ -268,7 +268,8 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
mXmlParser = new XmlParser(); mXmlParser = new XmlParser();
if (!mXmlParser->parse(file.get())) { if (!mXmlParser->parse(file.get())) {
delete mXmlParser; 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> // Start reading, search for root tag <amf>