mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
rgbfix: Add check to malloc()
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
@@ -380,6 +380,8 @@ int main(int argc, char *argv[])
|
|||||||
warnx("ROM size is bigger than 8MiB");
|
warnx("ROM size is bigger than 8MiB");
|
||||||
|
|
||||||
buf = malloc(newsize - romsize);
|
buf = malloc(newsize - romsize);
|
||||||
|
if (buf == NULL)
|
||||||
|
errx(1, "Couldn't allocate memory for padded ROM.");
|
||||||
memset(buf, padvalue, newsize - romsize);
|
memset(buf, padvalue, newsize - romsize);
|
||||||
fwrite(buf, 1, newsize - romsize, rom);
|
fwrite(buf, 1, newsize - romsize, rom);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user