From 7b54b0f40623b7c5e3a657f03dfe1fa06926ed79 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 21 Dec 2023 20:54:49 +0100 Subject: [PATCH] Fix leak - closes https://github.com/assimp/assimp/issues/5390 --- code/AssetLib/Irr/IRRLoader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index 99e053892..2a481a6d8 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Parse the XML // Find the scene root from document root. const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene"); - if (!sceneRoot) throw new DeadlyImportError("IRR: not found in file"); + if (!sceneRoot) { + delete root; + throw new DeadlyImportError("IRR: not found in file"); + } for (pugi::xml_node &child : sceneRoot.children()) { // XML elements are either nodes, animators, attributes, or materials if (!ASSIMP_stricmp(child.name(), "node")) {