From 7fd0f2b1fb6d94e7dc1316421e674d891ddd8327 Mon Sep 17 00:00:00 2001 From: cutealien Date: Mon, 2 Oct 2023 21:49:08 +0000 Subject: [PATCH] COBJMeshFileLoader: Avoid memory leak when handling files with invalid vertex indices Thanks @sfan5 for report and patch Was part of the Minetest commit 80e1609 patch which was applied earlier (couldn't apply this with the rest as the rest could be fixed in Irrlicht 1.8, while this one is about new Irrlicht 1.9 code) git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6548 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COBJMeshFileLoader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp index a9ed3045..02d6c722 100644 --- a/source/Irrlicht/COBJMeshFileLoader.cpp +++ b/source/Irrlicht/COBJMeshFileLoader.cpp @@ -255,6 +255,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file) { os::Printer::log("Invalid vertex index in this line", wordBuffer.c_str(), ELL_ERROR); delete [] buf; + cleanUp(); return 0; } if ( Idx[1] >= 0 && Idx[1] < (irr::s32)textureCoordBuffer.size() )