]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagtga.cpp
Added extra hit test style for more accurate reporting
[wxWidgets.git] / src / common / imagtga.cpp
index 281682cbb9f6773bdcb49d090d1011a649abfeae..6d65dd788929cad8b8961ce84ce6d51b8a61b747 100644 (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;
 }