From 9344074a04357fb0e8fd2537557f148dbc15ce8f Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 6 Feb 2018 19:22:32 +0200 Subject: [PATCH] MDLLoader: Replace raw pointer with vector to fix a memory leak --- code/MDLFileData.h | 4 ++-- code/MDLLoader.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/MDLFileData.h b/code/MDLFileData.h index 56f686280..ba732add0 100644 --- a/code/MDLFileData.h +++ b/code/MDLFileData.h @@ -844,11 +844,11 @@ struct IntGroupInfo_MDL7 struct IntGroupData_MDL7 { IntGroupData_MDL7() - : pcFaces(NULL), bNeed2UV(false) + : bNeed2UV(false) {} //! Array of faces that belong to the group - MDL::IntFace_MDL7* pcFaces; + std::vector pcFaces; //! Array of vertex positions std::vector vPositions; diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index 5dd471cf5..3f2bb084b 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -1502,7 +1502,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( ) groupData.bNeed2UV = true; } } - groupData.pcFaces = new MDL::IntFace_MDL7[groupInfo.pcGroup->numtris]; + groupData.pcFaces.resize(groupInfo.pcGroup->numtris); // read all faces into the preallocated arrays ReadFaces_3DGS_MDL7(groupInfo, groupData);