mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 12:50:51 +00:00
IMAGE: Fix potential memory leaks
This commit is contained in:
parent
a6307b768c
commit
6ce6922eef
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user