From 1775f690d5e3dfc2f70c0e416c91371c848b9f25 Mon Sep 17 00:00:00 2001 From: Andrea Dalla Costa Date: Sat, 11 Jan 2020 23:55:25 +0100 Subject: [PATCH] firmware-utils/mksenaofw: fix possible memory leak Add missing calls to `free` for variable `pmodel`. Signed-off-by: Andrea Dalla Costa --- tools/firmware-utils/src/mksenaofw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/firmware-utils/src/mksenaofw.c b/tools/firmware-utils/src/mksenaofw.c index b0fb7203c330..d9ccfbc1e042 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); -- 2.30.2