From 68bc6a06b93ee2881ed4b62dbe7f29294743d33e Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 23 Aug 2022 14:17:56 +0300 Subject: [PATCH] Use unique_ptr for aaiBones instead of explicit delete[] --- code/AssetLib/SMD/SMDLoader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/AssetLib/SMD/SMDLoader.cpp b/code/AssetLib/SMD/SMDLoader.cpp index 2a43aab09..78ff397b7 100644 --- a/code/AssetLib/SMD/SMDLoader.cpp +++ b/code/AssetLib/SMD/SMDLoader.cpp @@ -268,7 +268,7 @@ void SMDImporter::CreateOutputMeshes() { typedef std::pair TempWeightListEntry; typedef std::vector< TempWeightListEntry > TempBoneWeightList; - TempBoneWeightList* aaiBones = new TempBoneWeightList[asBones.size()](); + std::unique_ptr aaiBones(new TempBoneWeightList[asBones.size()]()); // try to reserve enough memory without wasting too much for (unsigned int iBone = 0; iBone < asBones.size();++iBone) { @@ -390,7 +390,6 @@ void SMDImporter::CreateOutputMeshes() { ++iNum; } } - delete[] aaiBones; } }