Core: Allow deserializing PNG savestates with ignoring extdata
Vicki Pfau vi@endrift.com
Mon, 01 Feb 2021 01:53:20 -0800
1 files changed,
5 insertions(+),
3 deletions(-)
jump to
M
src/core/serialize.c
→
src/core/serialize.c
@@ -283,7 +283,11 @@ success = success && PNGReadPixels(png, info, pixels, width, height, width);
success = success && PNGReadFooter(png, end); PNGReadClose(png, info, end); - if (success) { + if (!success) { + free(pixels); + mappedMemoryFree(state, stateSize); + return NULL; + } else if (extdata) { struct mStateExtdataItem item = { .size = width * height * 4, .data = pixels,@@ -292,8 +296,6 @@ };
mStateExtdataPut(extdata, EXTDATA_SCREENSHOT, &item); } else { free(pixels); - mappedMemoryFree(state, stateSize); - return 0; } return state; }