all repos — mgba @ 97931784e7c893f1bdee787f771f4ab074ff9451

mGBA Game Boy Advance Emulator

GBA: Do not put decoded image on the stack
Jeffrey Pfau jeffrey@endrift.com
Thu, 27 Nov 2014 11:18:22 -0800
commit

97931784e7c893f1bdee787f771f4ab074ff9451

parent

55ba676d7c7fcc665d4b454e80db82428f4adea1

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M src/gba/gba-serialize.csrc/gba/gba-serialize.c

@@ -153,15 +153,17 @@ if (!png || !info || !end) {

PNGReadClose(png, info, end); return false; } - uint32_t pixels[VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4]; + uint32_t* pixels = malloc(VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4); PNGInstallChunkHandler(png, gba, _loadPNGChunkHandler, "gbAs"); PNGReadHeader(png, info); - PNGReadPixels(png, info, &pixels, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, VIDEO_HORIZONTAL_PIXELS); + PNGReadPixels(png, info, pixels, VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS, VIDEO_HORIZONTAL_PIXELS); PNGReadFooter(png, end); PNGReadClose(png, info, end); gba->video.renderer->putPixels(gba->video.renderer, VIDEO_HORIZONTAL_PIXELS, pixels); GBASyncPostFrame(gba->sync); + + free(pixels); return true; } #endif