From 61097479c87a98da8acb80ec7e9916c888b53d51 Mon Sep 17 00:00:00 2001 From: wise86Android Date: Sat, 24 Sep 2016 15:55:37 +0200 Subject: [PATCH] 122243 Resource leak --- code/MDLMaterialLoader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/MDLMaterialLoader.cpp b/code/MDLMaterialLoader.cpp index a84afad22..3425d7b09 100644 --- a/code/MDLMaterialLoader.cpp +++ b/code/MDLMaterialLoader.cpp @@ -488,7 +488,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( unsigned int iWidth, unsigned int iHeight) { - aiTexture* pcNew = NULL; + aiTexture* pcNew = nullptr; // get the type of the skin unsigned int iMasked = (unsigned int)(iType & 0xF); @@ -522,7 +522,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( memcpy(pcNew->pcData,szCurrent,pcNew->mWidth); szCurrent += iWidth; } - if (0x7 == iMasked) + else if (0x7 == iMasked) { // ***** REFERENCE TO EXTERNAL FILE ***** if (1 != iHeight) @@ -546,6 +546,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( else if (iMasked || !iType || (iType && iWidth && iHeight)) { // ***** STANDARD COLOR TEXTURE ***** + if(pcNew!= nullptr) + delete pcNew; + pcNew = new aiTexture(); if (!iHeight || !iWidth) {