ref: 2e695334c1e1fd909e97e9e6a1e91b61ebbffe9e
parent: e2b4554a5c933eaebeb394d9057a6abcd68ac3e7
author: Antonio Niño Díaz <antonio_nd@outlook.com>
date: Tue Apr 3 18:37:01 EDT 2018
rgbfix: Add check to malloc() Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -380,6 +380,8 @@
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);