rgbfix: Add check to malloc()

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-04-03 22:37:01 +01:00
parent e2b4554a5c
commit 2e695334c1

View File

@@ -380,6 +380,8 @@ int main(int argc, char *argv[])
warnx("ROM size is bigger than 8MiB");
buf = malloc(newsize - romsize);
if (buf == NULL)
errx(1, "Couldn't allocate memory for padded ROM.");
memset(buf, padvalue, newsize - romsize);
fwrite(buf, 1, newsize - romsize, rom);