Browse Source

Assimp: fixed 3 memory leaks

Léo Terziman 11 years ago
parent
commit
ec3ef0c9d6
2 changed files with 9 additions and 0 deletions
  1. 2 0
      code/Exporter.cpp
  2. 7 0
      code/SceneCombiner.cpp

+ 2 - 0
code/Exporter.cpp

@@ -176,6 +176,8 @@ Exporter :: Exporter()
 Exporter :: ~Exporter()
 Exporter :: ~Exporter()
 {
 {
 	FreeBlob();
 	FreeBlob();
+
+	delete pimpl;
 }
 }
 
 
 
 

+ 7 - 0
code/SceneCombiner.cpp

@@ -901,6 +901,9 @@ void SceneCombiner::MergeMaterials(aiMaterial** dest,
 		size += (*it)->mNumProperties;
 		size += (*it)->mNumProperties;
 	}
 	}
 
 
+	out->Clear();
+	delete[] out->mProperties;
+
 	out->mNumAllocated = size;
 	out->mNumAllocated = size;
 	out->mNumProperties = 0;
 	out->mNumProperties = 0;
 	out->mProperties = new aiMaterialProperty*[out->mNumAllocated];
 	out->mProperties = new aiMaterialProperty*[out->mNumAllocated];
@@ -1062,6 +1065,10 @@ void SceneCombiner::Copy (aiMaterial** _dest, const aiMaterial* src)
 	ai_assert(NULL != _dest && NULL != src);
 	ai_assert(NULL != _dest && NULL != src);
 
 
 	aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() );
 	aiMaterial* dest = (aiMaterial*) ( *_dest = new aiMaterial() );
+
+	dest->Clear();
+	delete[] dest->mProperties;
+
 	dest->mNumAllocated  =  src->mNumAllocated;
 	dest->mNumAllocated  =  src->mNumAllocated;
 	dest->mNumProperties =  src->mNumProperties;
 	dest->mNumProperties =  src->mNumProperties;
 	dest->mProperties    =  new aiMaterialProperty* [dest->mNumAllocated];
 	dest->mProperties    =  new aiMaterialProperty* [dest->mNumAllocated];