uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit f49143782abd21bb9b53ba5207ac09ab1e4da8e0
parent ef2b2e881b68ed412522641a692b3de93222e87d
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date:   Sat, 25 Dec 2021 15:05:33 +0100

ppu_resize: don't leak if one layer failed to resize

Diffstat:
Msrc/devices/ppu.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 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;