diff --git a/src/devices/ppu.c b/src/devices/ppu.c index 2a6b03c..d3ab8be 100644 --- a/src/devices/ppu.c +++ b/src/devices/ppu.c @@ -59,8 +59,11 @@ ppu_resize(Ppu *p, Uint16 width, Uint16 height) Uint8 *bg = realloc(p->bg.pixels, width * height), *fg = realloc(p->fg.pixels, width * height); - if(!bg || !fg) + if(!bg || !fg) { + free(bg); + free(fg); return; + } p->bg.pixels = bg; p->fg.pixels = fg; p->width = width;