[rtems commit] score: Use _Workspace_Allocate_or_fatal_error()

Gedare Bloom gedare at rtems.org
Fri Jan 12 21:01:25 UTC 2018


Module:    rtems
Branch:    4.10
Commit:    0e75aae563474a15b9202411b2e42a8e466abd8c
Changeset: http://git.rtems.org/rtems/commit/?id=0e75aae563474a15b9202411b2e42a8e466abd8c

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Aug 24 15:56:49 2012 +0200

score: Use _Workspace_Allocate_or_fatal_error()

Use _Workspace_Allocate_or_fatal_error() consistently in case auto
extend is turned off.  This helps to avoid undefined behaviour in
_API_Mutex_Allocate() in case _API_Mutex_Information() fails.

---

 cpukit/score/src/objectextendinformation.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c
index c56a831..d94d5cd 100644
--- a/cpukit/score/src/objectextendinformation.c
+++ b/cpukit/score/src/objectextendinformation.c
@@ -142,11 +142,14 @@ void _Objects_Extend_information(
     block_size = block_count *
            (sizeof(void *) + sizeof(uint32_t) + sizeof(Objects_Name *)) +
           ((maximum + minimum_index) * sizeof(Objects_Control *));
-    object_blocks = (void**) _Workspace_Allocate( block_size );
-
-    if ( !object_blocks ) {
-      _Workspace_Free( new_object_block );
-      return;
+    if ( information->auto_extend ) {
+      object_blocks = _Workspace_Allocate( block_size );
+      if ( !object_blocks ) {
+        _Workspace_Free( new_object_block );
+        return;
+      }
+    } else {
+      object_blocks = _Workspace_Allocate_or_fatal_error( block_size );
     }
 
     /*



More information about the vc mailing list