Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/35066 )
Change subject: firmware.c: Check pointer returned by malloc ......................................................................
firmware.c: Check pointer returned by malloc
Change-Id: Iecf92a9acc54a4ab0a94867e5db265e1db943d53 Signed-off-by: Patrick Georgi pgeorgi@google.com Found-by: Coverity Scan #220610 --- M firmware.c 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/66/35066/1
diff --git a/firmware.c b/firmware.c index b3abafe..d15eb69 100644 --- a/firmware.c +++ b/firmware.c @@ -191,6 +191,10 @@ fseek(f, 0, SEEK_SET);
fw = malloc(fsize); + if (!fw) { + printf("ERROR: out of memory.\n"); + return 0; + } if (fread(fw, fsize, 1, f) != 1) { perror(filename); fclose(f);