Browse Source

134062 Use after free

wise86Android 9 years ago
parent
commit
04e0552f9e
2 changed files with 7 additions and 1 deletions
  1. 3 1
      code/MakeVerboseFormat.cpp
  2. 4 0
      test/unit/utCoverityTest.cpp

+ 3 - 1
code/MakeVerboseFormat.cpp

@@ -168,6 +168,8 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
         }
     }
 
+
+
     // build output vertex weights
     for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
     {
@@ -177,11 +179,11 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
             aiVertexWeight *weightToCopy = &( newWeights[i][0] );
             memcpy(pcMesh->mBones[i]->mWeights, weightToCopy,
                 sizeof(aiVertexWeight) * newWeights[i].size());
-            delete[] newWeights;
         } else {
             pcMesh->mBones[i]->mWeights = NULL;
         }
     }
+    delete[] newWeights;
 
     // delete the old members
     delete[] pcMesh->mVertices;

+ 4 - 0
test/unit/utCoverityTest.cpp

@@ -0,0 +1,4 @@
+//
+// Created by wise on 9/24/16.
+//
+