[rtems commit] cpukit/fdt: Free index before container
    Joel Sherrill 
    joel at rtems.org
       
    Mon Oct  3 18:14:02 UTC 2022
    
    
  
Module:    rtems
Branch:    master
Commit:    3af84c1beabd129c08d5d1bfcb553c79ad59d462
Changeset: http://git.rtems.org/rtems/commit/?id=3af84c1beabd129c08d5d1bfcb553c79ad59d462
Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Tue Sep 20 10:30:12 2022 -0500
cpukit/fdt: Free index before container
Ensure that the index is released before the structure containing it is
freed and NULLed.
Updates #4460
---
 cpukit/libmisc/rtems-fdt/rtems-fdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
index 1d3b82ae29..bea01dbf78 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
@@ -700,14 +700,14 @@ rtems_fdt_unload (rtems_fdt_handle* handle)
 
   rtems_chain_extract_unprotected (&handle->blob->node);
 
+  rtems_fdt_release_index(&handle->blob->index);
+
   free (handle->blob);
 
   handle->blob = NULL;
 
   rtems_fdt_unlock (fdt);
 
-  rtems_fdt_release_index(&handle->blob->index);
-
   return 0;
 }
 
    
    
More information about the vc
mailing list