ppu_resize: don't leak if one layer failed to resize
This commit is contained in:
parent
ef2b2e881b
commit
f49143782a
|
@ -59,8 +59,11 @@ ppu_resize(Ppu *p, Uint16 width, Uint16 height)
|
||||||
Uint8
|
Uint8
|
||||||
*bg = realloc(p->bg.pixels, width * height),
|
*bg = realloc(p->bg.pixels, width * height),
|
||||||
*fg = realloc(p->fg.pixels, width * height);
|
*fg = realloc(p->fg.pixels, width * height);
|
||||||
if(!bg || !fg)
|
if(!bg || !fg) {
|
||||||
|
free(bg);
|
||||||
|
free(fg);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
p->bg.pixels = bg;
|
p->bg.pixels = bg;
|
||||||
p->fg.pixels = fg;
|
p->fg.pixels = fg;
|
||||||
p->width = width;
|
p->width = width;
|
||||||
|
|
Loading…
Reference in New Issue