From 43d6a36faa96b7a63a8779906272078dc9161e91 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 2 Sep 2019 17:12:31 +0200 Subject: util/iteflash: Close file on error path Found by Coverity Scan #58166 BUG=none TEST=none BRANCH=none Change-Id: I1caa2a407a2c623c006c500a56c7048649ebb158 Signed-off-by: Patrick Georgi Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781470 Tested-by: Patrick Georgi Commit-Queue: Patrick Georgi Reviewed-by: Daisuke Nojiri --- util/iteflash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/iteflash.c b/util/iteflash.c index 68e4b34862..fd83980c77 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -1502,6 +1502,7 @@ static int write_flash(struct common_hnd *chnd, const char *filename, fprintf(stderr, "%s: Failed to read %d bytes from %s with " "ferror() %d\n", __func__, size, filename, ferror(hnd)); free(buffer); + fclose(hnd); return -EIO; } fclose(hnd); -- cgit v1.2.1