aboutsummaryrefslogtreecommitdiffstats
path: root/tools/imagetool.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-03-16 07:45:37 -0600
committerTom Rini <trini@konsulko.com>2016-03-22 12:16:19 -0400
commitb12a81c4ccfdfac1eabefdaeba2a19fab3102716 (patch)
treea8c821297ec4c2ae464386f7c562c7a10501caf5 /tools/imagetool.c
parent4708a07c7cfa754658d06283a399ddb175278de7 (diff)
downloadu-boot-midas-b12a81c4ccfdfac1eabefdaeba2a19fab3102716.tar.gz
u-boot-midas-b12a81c4ccfdfac1eabefdaeba2a19fab3102716.tar.bz2
u-boot-midas-b12a81c4ccfdfac1eabefdaeba2a19fab3102716.zip
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 <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/imagetool.c')
-rw-r--r--tools/imagetool.c1
1 files changed, 1 insertions, 0 deletions
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);