From 402b362db447c8163b4069537753b1ede3533d18 Mon Sep 17 00:00:00 2001 From: Andrea Dalla Costa Date: Sat, 11 Jan 2020 22:27:39 +0100 Subject: [PATCH] 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 --- tools/firmware-utils/src/dgfirmware.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.25.1