Util: Fix crash if PNG header fails to write

This commit is contained in:
Vicki Pfau 2020-06-28 00:40:24 -07:00
parent f6522ea084
commit b68c393223
2 changed files with 4 additions and 6 deletions

View File

@ -35,6 +35,7 @@ Other fixes:
- Qt: Fix file handle leak on opening an invalid ROM - Qt: Fix file handle leak on opening an invalid ROM
- Qt: Fix a race condition in the frame inspector - Qt: Fix a race condition in the frame inspector
- Qt: Fix Italian RTC translation (fixes mgba.io/i/1798) - Qt: Fix Italian RTC translation (fixes mgba.io/i/1798)
- Util: Fix crash if PNG header fails to write
Misc: Misc:
- Debugger: Keep track of global cycle count - Debugger: Keep track of global cycle count
- FFmpeg: Add looping option for GIF/APNG - FFmpeg: Add looping option for GIF/APNG

View File

@ -47,19 +47,16 @@ static png_infop _pngWriteHeader(png_structp png, unsigned width, unsigned heigh
return 0; return 0;
} }
png_set_IHDR(png, info, width, height, 8, type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); png_set_IHDR(png, info, width, height, 8, type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_write_info(png, info);
return info; return info;
} }
png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height) { png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height) {
png_infop info = _pngWriteHeader(png, width, height, PNG_COLOR_TYPE_RGB); return _pngWriteHeader(png, width, height, PNG_COLOR_TYPE_RGB);
png_write_info(png, info);
return info;
} }
png_infop PNGWriteHeaderA(png_structp png, unsigned width, unsigned height) { png_infop PNGWriteHeaderA(png_structp png, unsigned width, unsigned height) {
png_infop info = _pngWriteHeader(png, width, height, PNG_COLOR_TYPE_RGB_ALPHA); return _pngWriteHeader(png, width, height, PNG_COLOR_TYPE_RGB_ALPHA);
png_write_info(png, info);
return info;
} }
png_infop PNGWriteHeader8(png_structp png, unsigned width, unsigned height) { png_infop PNGWriteHeader8(png_structp png, unsigned width, unsigned height) {