Use unique_ptr for aaiBones instead of explicit delete[]

pull/4699/head
Turo Lamminen 2022-08-23 14:17:56 +03:00
parent 03397d42e2
commit 68bc6a06b9
1 changed files with 1 additions and 2 deletions

View File

@ -268,7 +268,7 @@ void SMDImporter::CreateOutputMeshes() {
typedef std::pair<unsigned int,float> TempWeightListEntry; typedef std::pair<unsigned int,float> TempWeightListEntry;
typedef std::vector< TempWeightListEntry > TempBoneWeightList; typedef std::vector< TempWeightListEntry > TempBoneWeightList;
TempBoneWeightList* aaiBones = new TempBoneWeightList[asBones.size()](); std::unique_ptr<TempBoneWeightList[]> aaiBones(new TempBoneWeightList[asBones.size()]());
// try to reserve enough memory without wasting too much // try to reserve enough memory without wasting too much
for (unsigned int iBone = 0; iBone < asBones.size();++iBone) { for (unsigned int iBone = 0; iBone < asBones.size();++iBone) {
@ -390,7 +390,6 @@ void SMDImporter::CreateOutputMeshes() {
++iNum; ++iNum;
} }
} }
delete[] aaiBones;
} }
} }