firmware-utils/mksenaofw: fix possible memory leak

Add missing calls to `free` for variable `pmodel`.

Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
This commit is contained in:
Andrea Dalla Costa 2020-01-11 23:55:25 +01:00 committed by Jo-Philipp Wich
parent b886d3c8f3
commit 1775f690d5
1 changed files with 2 additions and 0 deletions

View File

@ -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);