[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.
pull/3890/head
Jason C 2021-05-05 17:13:10 -04:00
parent 1e89c06157
commit 785cca1bb4
1 changed files with 1 additions and 0 deletions

View File

@ -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 + ".");
}