[U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size

Simon Glass sjg at chromium.org
Wed Mar 16 14:45:37 CET 2016


There is a missing close() on the error path. Add it.

Reported-by: Coverity (CID: 138496)
Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/imagetool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/imagetool.c b/tools/imagetool.c
index 351211c..916ab96 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -107,6 +107,7 @@ int imagetool_get_filesize(struct image_tool_params *params, const char *fname)
 	if (fstat(fd, &sbuf) < 0) {
 		fprintf(stderr, "%s: Can't stat %s: %s\n",
 			params->cmdname, fname, strerror(errno));
+		close(fd);
 		return -1;
 	}
 	close(fd);
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list