[PATCH] blspec: Fix crash with menu disabled

Jürgen Beisert jbe at pengutronix.de
Wed Oct 30 07:05:51 EDT 2013


On Wednesday 30 October 2013 11:37:55 Sascha Hauer wrote:
> blspec->menu is only valid when menu support is enabled. Check for it
> before dereferencing the pointer.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  include/blspec.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/blspec.h b/include/blspec.h
> index 8422e5b..aa836e6 100644
> --- a/include/blspec.h
> +++ b/include/blspec.h
> @@ -84,7 +84,8 @@ static inline void blspec_free(struct blspec *blspec)
>
>  	list_for_each_entry_safe(entry, tmp, &blspec->entries, list)
>  		blspec_entry_free(entry);
> -	free(blspec->menu->display);
> +	if (blspec->menu)
> +		free(blspec->menu->display);
>  	free(blspec->menu);
>  	free(blspec);
>  }

Tested-by: Juergen Beisert <jbe at pengutronix.de>

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |



More information about the barebox mailing list