diff options
author | Simon Glass <sjg@chromium.org> | 2016-03-16 07:45:42 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-03-22 12:16:27 -0400 |
commit | 3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d (patch) | |
tree | ced97b8abc752ca5e63f3fb342028ea85f8da08b /tools | |
parent | 7b0bbd886d553c3cffc5b3eb29256b05856076ee (diff) | |
download | u-boot-3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d.tar.gz u-boot-3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d.tar.bz2 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.c | 3 |
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: |