aboutsummaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorcraigsc2020-01-11 12:08:21 -0800
committercraigsc2020-01-11 12:08:21 -0800
commit3dd4fb16f017a8eab5c6c11fd119a397b457866e (patch)
tree5b80b5c5038d8577c2d674a5a4742b335deca515 /image
parentf9f81ea9baecb714f26cf1c17a1b0ae58431467b (diff)
parent5893672b80f00fced33c42e63471d68ba47d7dd4 (diff)
downloadscummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.tar.gz
scummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.tar.bz2
scummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'image')
-rw-r--r--image/png.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/image/png.cpp b/image/png.cpp
index 1072d41a18..307334a64b 100644
--- a/image/png.cpp
+++ b/image/png.cpp
@@ -283,11 +283,19 @@ bool writePNG(Common::WriteStream &out, const Graphics::Surface &input) {
png_structp pngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!pngPtr) {
+ if (tmp) {
+ tmp->free();
+ delete tmp;
+ }
return false;
}
png_infop infoPtr = png_create_info_struct(pngPtr);
if (!infoPtr) {
png_destroy_write_struct(&pngPtr, NULL);
+ if (tmp) {
+ tmp->free();
+ delete tmp;
+ }
return false;
}