ensure that image data is always freed by using wxON_BLOCK_EXIT in ReadTGA() (coverity id 202)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-11-27 15:01:58 +00:00
parent ffe3c9ed98
commit 566921195a

View File

@@ -30,6 +30,7 @@
#include "wx/imagtga.h"
#include "wx/log.h"
#include "wx/scopeguard.h"
// ----------------------------------------------------------------------------
// constants
@@ -187,6 +188,8 @@ int ReadTGA(wxImage* image, wxInputStream& stream)
return wxTGA_MEMERR;
}
wxON_BLOCK_EXIT1(free, imageData);
unsigned char *dst = image->GetData();
unsigned char* alpha = NULL;
@@ -626,8 +629,6 @@ int ReadTGA(wxImage* image, wxInputStream& stream)
return wxTGA_INVFORMAT;
}
free(imageData);
return wxTGA_OK;
}