From e254f80a3a6884f64895767b7a803853a5c585c6 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 8 Jul 2022 10:17:11 +0200 Subject: [PATCH 1/2] Fix memory leak in D3MFOpcPackage - closes https://github.com/assimp/assimp/issues/4628 --- code/AssetLib/3MF/D3MFOpcPackage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index f88039ae8..fea49a6bd 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -186,6 +186,9 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) : D3MFOpcPackage::~D3MFOpcPackage() { mZipArchive->Close(mRootStream); delete mZipArchive; + for (auto tex : mEmbeddedTextures) { + delete mEmbeddedTextures[i]; + } } IOStream *D3MFOpcPackage::RootStream() const { From c5dfcac08a26c554494a22dc80620e716d929fdc Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 8 Jul 2022 10:25:40 +0200 Subject: [PATCH 2/2] Update D3MFOpcPackage.cpp --- code/AssetLib/3MF/D3MFOpcPackage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/3MF/D3MFOpcPackage.cpp b/code/AssetLib/3MF/D3MFOpcPackage.cpp index fea49a6bd..a2182dc29 100644 --- a/code/AssetLib/3MF/D3MFOpcPackage.cpp +++ b/code/AssetLib/3MF/D3MFOpcPackage.cpp @@ -187,7 +187,7 @@ D3MFOpcPackage::~D3MFOpcPackage() { mZipArchive->Close(mRootStream); delete mZipArchive; for (auto tex : mEmbeddedTextures) { - delete mEmbeddedTextures[i]; + delete tex; } }