all repos — mgba @ 88212fc2deb72b3ab85313852b0b091edc88403b

mGBA Game Boy Advance Emulator

Core: Allow deserializing PNG savestates with ignoring extdata
Vicki Pfau vi@endrift.com
Mon, 01 Feb 2021 01:53:20 -0800
commit

88212fc2deb72b3ab85313852b0b091edc88403b

parent

80fb86a930f9f97f339f69e0f960863850176b51

1 files changed, 5 insertions(+), 3 deletions(-)

jump to
M src/core/serialize.csrc/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; }