From ec3ef0c9d6b685cdf6153d9f8a6b1dd94a3cfd34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Terziman?= Date: Tue, 17 Dec 2013 10:03:06 +0100 Subject: [PATCH] Assimp: fixed 3 memory leaks --- code/Exporter.cpp | 2 ++ code/SceneCombiner.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/code/Exporter.cpp b/code/Exporter.cpp index 306ed824a..7adb9d31d 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -176,6 +176,8 @@ Exporter :: Exporter() Exporter :: ~Exporter() { FreeBlob(); + + delete pimpl; } diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index c8e407b3b..9df2fb26a 100644 --- a/code/SceneCombiner.cpp +++ b/code/SceneCombiner.cpp @@ -901,6 +901,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest, size += (*it)->mNumProperties; } + out->Clear(); + delete[] out->mProperties; + out->mNumAllocated = size; out->mNumProperties = 0; out->mProperties = new aiMaterialProperty*[out->mNumAllocated]; @@ -1062,6 +1065,10 @@ void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src) ai_assert(NULL != _dest && NULL != src); aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() ); + + dest->Clear(); + delete[] dest->mProperties; + dest->mNumAllocated = src->mNumAllocated; dest->mNumProperties = src->mNumProperties; dest->mProperties = new aiMaterialProperty* [dest->mNumAllocated];