Core: Allow deserializing PNG savestates with ignoring extdata

This commit is contained in:
Vicki Pfau 2021-02-01 01:53:20 -08:00
parent 80fb86a930
commit 88212fc2de
1 changed files with 5 additions and 3 deletions

View File

@ -283,7 +283,11 @@ static void* _loadPNGState(struct mCore* core, struct VFile* vf, struct mStateEx
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 @@ static void* _loadPNGState(struct mCore* core, struct VFile* vf, struct mStateEx
mStateExtdataPut(extdata, EXTDATA_SCREENSHOT, &item);
} else {
free(pixels);
mappedMemoryFree(state, stateSize);
return 0;
}
return state;
}