[rtems commit] cpukit/fdt: Check correct allocation

Joel Sherrill joel at rtems.org
Mon Oct 3 18:13:42 UTC 2022


Module:    rtems
Branch:    5
Commit:    cab00c703525648cb8cd77c0b29aaf80d3f56276
Changeset: http://git.rtems.org/rtems/commit/?id=cab00c703525648cb8cd77c0b29aaf80d3f56276

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Tue Sep 20 10:24:59 2022 -0500

cpukit/fdt: Check correct allocation

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 b96ccbc1b0..122407f630 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
@@ -163,7 +163,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 vc mailing list