tools: image-host: Fix potential memory leak
PATCH 1/1 tools: image-host: Fix potential memory leak
From: Maks Mishin <[email protected]>
Signed-off-by Maks Mishin <[email protected]>
--- tools/image-host.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/image-host.c +5 -2
@@ -1029,10 +1029,13 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, ®ion_proplen))return -1 ; -if (fit_image_setup_sig (&info, keydir, keyfile, fit, conf_name, noffset, + ret =fit_image_setup_sig (&info, keydir, keyfile, fit, conf_name, noffset, require_keys ?"conf" :NULL , engine_id, - algo_name)) + algo_name); +if (ret) { +free (info.name);return -1 ; + } ret = info.crypto->sign (&info, region, region_count, &value, &value_len);
Signature · 1 line
2.34.1
Hi,
Quoted 12 lines · On 4/18/25 10:30 AM, [email protected] wrote:
From: Maks Mishin <[email protected]>
Signed-off-by Maks Mishin <[email protected]>--- tools/image-host.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tools/image-host.c +0
-0
tools/image-host.c static int fit_config_process_sig(const char *keydir, const char *keyfile, · line 1036
Quoted 10 lines
tools/image-host.c +4
-2@@ -1029,10 +1029,13 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile, ®ion_proplen))return -1 ; -if (fit_image_setup_sig (&info, keydir, keyfile, fit, conf_name, noffset, + ret =fit_image_setup_sig (&info, keydir, keyfile, fit, conf_name, noffset, require_keys ?"conf" :NULL , engine_id, - algo_name)) + algo_name); +if (ret) { +free (info.name);
Don't we need to free it all the time (i mean in the happy path even, after it's not useful anymore?)? When is it not useful anymore?
Please provide some information in the commit log as well, thanks!
Cheers,
Quentin