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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user