Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33961
Change subject: util/amdfwtool: Close file descriptor on error ......................................................................
util/amdfwtool: Close file descriptor on error
Prevents a resource leak.
Change-Id: Id5da2df3e37cba499cd2e9a7c3ede34e4de2ed77 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1402139 --- M util/amdfwtool/amdfwtool.c 1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/33961/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 37dbcd0..e8ac0b1 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -566,11 +566,13 @@
if (fstat(fd, &fd_stat)) { printf("fstat error: %s\n", strerror(errno)); + close(fd); return -2; }
if (fd_stat.st_size > room) { printf("Error: %s will not fit. Exiting.\n", src_file); + close(fd); return -3; }