Merge pull request #4891 from Memphiz/fixcximageleak
authorjmarshallnz <jcmarsha@gmail.com>
Thu, 12 Jun 2014 01:59:20 +0000 (13:59 +1200)
committerJonathan Marshall <jmarshall@xbmc.org>
Sun, 15 Jun 2014 04:25:15 +0000 (16:25 +1200)
[cximage] - fix big memory leak in raw image decoder - thx to smf007 for

lib/cximage-6.0/CxImage/ximaenc.cpp

index 14e7890..ed8b779 100644 (file)
@@ -815,10 +815,12 @@ bool CxImage::Decode(CxFile *hFile, DWORD imagetype)
             if (newima.Decode( &hMemFile ))
             {
               Transfer(newima);
+              free(buffer);
               return true;
             }
             else
               hFile->Seek(pos, SEEK_SET);
+            free(buffer);
           }
           else
           {
@@ -1063,11 +1065,13 @@ bool CxImage::Decode(CxFile *hFile, DWORD imagetype)
         if (newima.Decode( &hMemFile ))
         {
           Transfer(newima);
+          free(buffer);
           return true;
         }
         else
         {
           strcpy(info.szLastError,newima.GetLastError());
+          free(buffer);
           return false;
         }
        }