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