浏览代码

Fix leak

- closes https://github.com/assimp/assimp/issues/5390
Kim Kulling 1 年之前
父节点
当前提交
7b54b0f406
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      code/AssetLib/Irr/IRRLoader.cpp

+ 4 - 1
code/AssetLib/Irr/IRRLoader.cpp

@@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
     // Parse the XML
     // Parse the XML
     // Find the scene root from document root.
     // Find the scene root from document root.
     const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene");
     const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene");
-    if (!sceneRoot) throw new DeadlyImportError("IRR: <irr_scene> not found in file");
+    if (!sceneRoot) {
+        delete root;
+        throw new DeadlyImportError("IRR: <irr_scene> not found in file");
+    }
     for (pugi::xml_node &child : sceneRoot.children()) {
     for (pugi::xml_node &child : sceneRoot.children()) {
         // XML elements are either nodes, animators, attributes, or materials
         // XML elements are either nodes, animators, attributes, or materials
         if (!ASSIMP_stricmp(child.name(), "node")) {
         if (!ASSIMP_stricmp(child.name(), "node")) {