... | ... |
@@ -59,8 +59,11 @@ ppu_resize(Ppu *p, Uint16 width, Uint16 height) |
59 | 59 |
Uint8 |
60 | 60 |
*bg = realloc(p->bg.pixels, width * height), |
61 | 61 |
*fg = realloc(p->fg.pixels, width * height); |
62 |
- if(!bg || !fg) |
|
62 |
+ if(!bg || !fg) { |
|
63 |
+ free(bg); |
|
64 |
+ free(fg); |
|
63 | 65 |
return; |
66 |
+ } |
|
64 | 67 |
p->bg.pixels = bg; |
65 | 68 |
p->fg.pixels = fg; |
66 | 69 |
p->width = width; |