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>
}
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);
}
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);