[PATCH] tools: image-host: Fix potential memory leak

Quentin Schulz quentin.schulz at cherry.de
Fri Apr 18 15:52:18 CEST 2025


Hi,

On 4/18/25 10:30 AM, ant.v.moryakov at gmail.com wrote:
> From: Maks Mishin <maks.mishinFZ at gmail.com>
> 
> Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
> ---
>   tools/image-host.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/image-host.c b/tools/image-host.c
> index 4a24dee8..453cd38f 100644
> --- a/tools/image-host.c
> +++ b/tools/image-host.c
> @@ -1029,10 +1029,13 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile,
>   				   &region_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


More information about the U-Boot mailing list