Sceneprecessor potential memory leak

pull/3505/head
Neil Clifford 2020-11-19 13:20:43 +00:00
parent 749a4963a2
commit fc842a0f97
1 changed files with 12 additions and 0 deletions

View File

@ -210,6 +210,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) {
// No rotation keys? Generate a dummy track
if (!channel->mNumRotationKeys) {
if (channel->mRotationKeys) {
delete[] channel->mRotationKeys;
channel->mRotationKeys = NULL;
}
ai_assert(!channel->mRotationKeys);
channel->mNumRotationKeys = 1;
channel->mRotationKeys = new aiQuatKey[1];
@ -225,6 +229,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) {
// No scaling keys? Generate a dummy track
if (!channel->mNumScalingKeys) {
if (channel->mScalingKeys) {
delete[] channel->mScalingKeys;
channel->mScalingKeys = NULL;
}
ai_assert(!channel->mScalingKeys);
channel->mNumScalingKeys = 1;
channel->mScalingKeys = new aiVectorKey[1];
@ -240,6 +248,10 @@ void ScenePreprocessor::ProcessAnimation(aiAnimation *anim) {
// No position keys? Generate a dummy track
if (!channel->mNumPositionKeys) {
if (channel->mPositionKeys) {
delete[] channel->mPositionKeys;
channel->mPositionKeys = NULL;
}
ai_assert(!channel->mPositionKeys);
channel->mNumPositionKeys = 1;
channel->mPositionKeys = new aiVectorKey[1];