From: Simon Glass Date: Wed, 16 Mar 2016 13:45:37 +0000 (-0600) Subject: mkimage: Close the file when unable to get its size X-Git-Tag: v2016.05-rc1~209 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b12a81c4ccfdfac1eabefdaeba2a19fab3102716;p=u-boot 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 --- 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);