aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src
diff options
context:
space:
mode:
authorAndrea Dalla Costa <andrea@dallacosta.me>2020-01-11 22:27:39 +0100
committerJo-Philipp Wich <jo@mein.io>2020-01-14 17:48:50 +0100
commit402b362db447c8163b4069537753b1ede3533d18 (patch)
tree451c896decda3df78064fd124e2c44732ddab6d0 /tools/firmware-utils/src
parent22b07ff73e0b3429b36f75694a082a68a4fdb013 (diff)
downloadupstream-402b362db447c8163b4069537753b1ede3533d18.tar.gz
upstream-402b362db447c8163b4069537753b1ede3533d18.tar.bz2
upstream-402b362db447c8163b4069537753b1ede3533d18.zip
firmware-utils/dgfirmare: fix possible resource leak
Add missing calls to `fclose` in functions `write_img`, `write_rootfs` and `write_kernel`. The not-closed files could lead to resource leaks. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
Diffstat (limited to 'tools/firmware-utils/src')
-rw-r--r--tools/firmware-utils/src/dgfirmware.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/dgfirmware.c b/tools/firmware-utils/src/dgfirmware.c
index e3257f1077..3ec4712ec9 100644
--- a/tools/firmware-utils/src/dgfirmware.c
+++ b/tools/firmware-utils/src/dgfirmware.c
@@ -86,6 +86,8 @@ void write_img(unsigned char* img, const char *fname)
fclose(fp);
exit(-1);
}
+
+ fclose(fp);
}
@@ -104,6 +106,8 @@ void write_rootfs(unsigned char* img, const char *fname)
fclose(fp);
exit(-1);
}
+
+ fclose(fp);
}
@@ -122,6 +126,8 @@ void write_kernel(unsigned char* img, const char *fname)
fclose(fp);
exit(-1);
}
+
+ fclose(fp);
}