mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
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: ebe0f53f48
)
Reported-by: Coverity (CID: 155064, 155065)
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d0cf5512e9
commit
ac71d4103e
2 changed files with 12 additions and 4 deletions
|
@ -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", ®init.address, ®init.data);
|
||||
|
|
|
@ -251,11 +251,15 @@ static void zynqmpimage_parse_initparams(struct zynqmp_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", ®init.address, ®init.data);
|
||||
|
|
Loading…
Reference in a new issue