From 2e695334c1e1fd909e97e9e6a1e91b61ebbffe9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Tue, 3 Apr 2018 22:37:01 +0100 Subject: [PATCH] rgbfix: Add check to malloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antonio Niño Díaz --- src/fix/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fix/main.c b/src/fix/main.c index 5877543c..2ad71c71 100644 --- a/src/fix/main.c +++ b/src/fix/main.c @@ -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);