From b12a81c4ccfdfac1eabefdaeba2a19fab3102716 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 16 Mar 2016 07:45:37 -0600 Subject: [PATCH] mkimage: Close the file when unable to get its size There is a missing close() on the error path. Add it. Reported-by: Coverity (CID: 138496) Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- tools/imagetool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/imagetool.c b/tools/imagetool.c index 351211cd53..916ab964d5 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.25.1