From 3bd3a54ac515c26c6f0abd001d74fac2c86a7e1d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 16 Mar 2016 07:45:42 -0600 Subject: [PATCH] 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 Reviewed-by: Tom Rini --- tools/fit_image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- 2.39.5