[PATCH v3 01/10] FIT: fix missing free in fit_open error path

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jul 3 11:30:41 PDT 2024


On 03.07.24 18:58, Marco Felsch wrote:
> Free the handle if read_file_2() fails.
> 
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
>  common/image-fit.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 251fda97b3fc..008804e6a6c3 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -922,6 +922,7 @@ struct fit_handle *fit_open(const char *filename, bool verbose,
>  			  max_size);
>  	if (ret && ret != -EFBIG) {
>  		pr_err("unable to read %s: %s\n", filename, strerror(-ret));
> +		free(handle);
>  		return ERR_PTR(ret);
>  	}
>  
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list