summaryrefslogtreecommitdiff
path: root/tools/zynqimage.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-12-20 09:58:31 +0100
committerTom Rini <trini@konsulko.com>2016-12-27 11:24:16 -0500
commitac71d4103e94f943a83e9905b0c7c9d3deff54df (patch)
tree1b1fdbb773b09d115f2e4201a127ad5577bacecf /tools/zynqimage.c
parentd0cf5512e9747f6e370c1c682c0f60474b5ca8e9 (diff)
downloadu-boot-imx-ac71d4103e94f943a83e9905b0c7c9d3deff54df.zip
u-boot-imx-ac71d4103e94f943a83e9905b0c7c9d3deff54df.tar.gz
u-boot-imx-ac71d4103e94f943a83e9905b0c7c9d3deff54df.tar.bz2
tools: mkimage: Call fclose in error path
This patch is fixing missing fclose() calls in error patch introduced by: "tools: mkimage: Use fstat instead of stat to avoid malicious hacks" (sha1: ebe0f53f48e8f9ecc823e533a85b05c13638c350) Reported-by: Coverity (CID: 155064, 155065) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/zynqimage.c')
-rw-r--r--tools/zynqimage.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/zynqimage.c b/tools/zynqimage.c
index b47132b..021d2d3 100644
--- a/tools/zynqimage.c
+++ b/tools/zynqimage.c
@@ -239,11 +239,15 @@ static void zynqimage_parse_initparams(struct zynq_header *zynqhdr,
}
err = fstat(fileno(fp), &path_stat);
- if (err)
+ if (err) {
+ fclose(fp);
return;
+ }
- if (!S_ISREG(path_stat.st_mode))
+ if (!S_ISREG(path_stat.st_mode)) {
+ fclose(fp);
return;
+ }
do {
r = fscanf(fp, "%x %x", &reginit.address, &reginit.data);