summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/zynqimage.c8
-rw-r--r--tools/zynqmpimage.c8
2 files changed, 12 insertions, 4 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);
diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c
index 60d8ed2..0c9a3da 100644
--- a/tools/zynqmpimage.c
+++ b/tools/zynqmpimage.c
@@ -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", &reginit.address, &reginit.data);