From: Andrea Dalla Costa Date: Sat, 11 Jan 2020 22:55:25 +0000 (+0100) Subject: firmware-utils/mksenaofw: fix possible memory leak X-Git-Tag: v21.02.0-rc1~4053 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1775f690d5e3dfc2f70c0e416c91371c848b9f25;p=openwrt%2Fstaging%2Fpepe2k.git firmware-utils/mksenaofw: fix possible memory leak Add missing calls to `free` for variable `pmodel`. Signed-off-by: Andrea Dalla Costa --- 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);