summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-03-16 07:45:42 -0600
committerTom Rini <trini@konsulko.com>2016-03-22 12:16:27 -0400
commit3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d (patch)
treeced97b8abc752ca5e63f3fb342028ea85f8da08b /tools
parent7b0bbd886d553c3cffc5b3eb29256b05856076ee (diff)
downloadu-boot-3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d.tar.gz
u-boot-3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d.tar.xz
u-boot-3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d.zip
mkimage: Ensure file is closed in fdt_property_file()
The file that is opened is not closed in all cases. Fix it. Reported-by: Coverity (CID: 138490) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/fit_image.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 9d553d10fb..6e5c143803 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -123,13 +123,14 @@ static int fdt_property_file(struct image_tool_params *params,
ret = fdt_property_placeholder(fdt, "data", sbuf.st_size, &ptr);
if (ret)
- return ret;
+ goto err;
ret = read(fd, ptr, sbuf.st_size);
if (ret != sbuf.st_size) {
fprintf(stderr, "%s: Can't read %s: %s\n",
params->cmdname, fname, strerror(errno));
goto err;
}
+ close(fd);
return 0;
err: