summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrea Dalla Costa <andrea@dallacosta.me>2020-01-11 23:55:25 +0100
committerJo-Philipp Wich <jo@mein.io>2020-01-14 17:48:50 +0100
commit1775f690d5e3dfc2f70c0e416c91371c848b9f25 (patch)
tree0837543fbaa29faf0bae2f4db65746bc09d8c79a /tools
parentb886d3c8f3d852a5d5bfcb41f439a808d9aa2d58 (diff)
downloadopenwrt-1775f690d5e3dfc2f70c0e416c91371c848b9f25.tar.gz
openwrt-1775f690d5e3dfc2f70c0e416c91371c848b9f25.tar.bz2
openwrt-1775f690d5e3dfc2f70c0e416c91371c848b9f25.zip
firmware-utils/mksenaofw: fix possible memory leak
Add missing calls to `free` for variable `pmodel`. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/mksenaofw.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/mksenaofw.c b/tools/firmware-utils/src/mksenaofw.c
index b0fb7203c3..d9ccfbc1e0 100644
--- a/tools/firmware-utils/src/mksenaofw.c
+++ b/tools/firmware-utils/src/mksenaofw.c
@@ -316,10 +316,12 @@ int decode_image(const char *input_file_name, const char *output_file_name)
if (fread(pmodel, 1, cw_header.model_size, fp_input) !=
cw_header.model_size) {
fprintf(stderr, "Incorrect header size reading model name!!");
+ free(pmodel);
fclose(fp_input);
fclose(fp_output);
return -1;
}
+ free(pmodel);
} else {
fprintf(stderr, "Incorrect header size reading model name!!");
fclose(fp_input);