[PATCH] cpukit/fdt: Check correct allocation

Chris Johns chrisj at rtems.org
Wed Sep 28 23:43:27 UTC 2022


OK and thanks.

Should this be fixed on 5 as well? If you think so consider it OK as well.

Thanks
Chris

On 29/9/2022 7:12 am, Kinsey Moore wrote:
> The second allocation check was mistakenly rechecking the first
> allocation. It now checks the correct allocation and ensures that names
> is not NULL.
> 
> Updates #4462
> ---
>  cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
> index 7dd2bc1047..1d3b82ae29 100644
> --- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
> +++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
> @@ -182,7 +182,7 @@ rtems_fdt_init_index (rtems_fdt_handle* fdt, rtems_fdt_blob* blob)
>    }
>  
>    names = calloc(1, total_name_memory);
> -  if (!entries)
> +  if (!names)
>    {
>      free(entries);
>      return -RTEMS_FDT_ERR_NO_MEMORY;


More information about the devel mailing list