coverity findings: fix resource leak in MakeVerboseFormat.

pull/736/head
Kim Kulling 2015-12-30 20:39:58 +01:00
parent 56e9a9168c
commit 043fef6d21
1 changed files with 5 additions and 4 deletions

View File

@ -172,13 +172,14 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
{
delete pcMesh->mBones[i]->mWeights;
if (!newWeights[i].empty())
{
if (!newWeights[i].empty()) {
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
memcpy(pcMesh->mBones[i]->mWeights,&newWeights[i][0],
memcpy(pcMesh->mBones[i]->mWeights, &newWeights[i][0],
sizeof(aiVertexWeight) * newWeights[i].size());
delete[] newWeights;
} else {
pcMesh->mBones[i]->mWeights = NULL;
}
else pcMesh->mBones[i]->mWeights = NULL;
}
// delete the old members