fix memory leak

pull/753/head
wise86Android 2016-01-17 15:18:12 +01:00
parent 4af9632269
commit c7f69e151e
2 changed files with 8 additions and 6 deletions

View File

@ -73,9 +73,11 @@ SkeletonMeshBuilder::SkeletonMeshBuilder( aiScene* pScene, aiNode* root, bool bK
root->mMeshes[0] = 0;
// create a dummy material for the mesh
pScene->mNumMaterials = 1;
pScene->mMaterials = new aiMaterial*[1];
pScene->mMaterials[0] = CreateMaterial();
if(pScene->mNumMaterials==0){
pScene->mNumMaterials = 1;
pScene->mMaterials = new aiMaterial*[1];
pScene->mMaterials[0] = CreateMaterial();
}
}
// ------------------------------------------------------------------------------------------------

View File

@ -54,7 +54,6 @@ public:
{
ex = new Assimp::Exporter();
im = new Assimp::Importer();
}
virtual void TearDown()
@ -73,7 +72,7 @@ protected:
// ------------------------------------------------------------------------------------------------
TEST_F(ColladaExportLight, testExportLight)
{
const char* file = "cameraExp.dae";
const char* file = "lightsExp.dae";
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/lights.dae",0);
ASSERT_TRUE(pTest!=NULL);
@ -88,7 +87,6 @@ TEST_F(ColladaExportLight, testExportLight)
}
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada","lightsExp.dae"));
const aiScene* imported = im->ReadFile(file,0);
@ -123,7 +121,9 @@ TEST_F(ColladaExportLight, testExportLight)
EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001);
EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001);
}
delete [] origLights;
}