summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-10 09:39:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-11 07:45:58 +0200
commitc2687666b199c44dacfa8d5e9b9939fa2dc8521e (patch)
tree4a642a7cdc70d029828e62d79b35e7768d7d3497
parentab5aeb1be1e7f501388cf4c8915f98efaaef754a (diff)
downloadrtems-c2687666b199c44dacfa8d5e9b9939fa2dc8521e.tar.bz2
rtems: Use _Objects_Free_nothing() for msg queues
Use _Objects_Free_nothing() for rtems_message_queue_construct() to avoid unreachable code in _CORE_message_queue_Close() in case only user-provided message buffers are used. Update #4007.
-rw-r--r--cpukit/rtems/src/msgqconstruct.c7
-rw-r--r--cpukit/score/src/coremsgclose.c8
2 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/rtems/src/msgqconstruct.c b/cpukit/rtems/src/msgqconstruct.c
index 6af57454cc..63ec75edff 100644
--- a/cpukit/rtems/src/msgqconstruct.c
+++ b/cpukit/rtems/src/msgqconstruct.c
@@ -41,7 +41,12 @@ static void *_Message_queue_Get_buffers(
return NULL;
}
- the_message_queue->free_message_buffers = config->storage_free;
+ if ( config->storage_free != NULL ) {
+ the_message_queue->free_message_buffers = config->storage_free;
+ } else {
+ the_message_queue->free_message_buffers = _Objects_Free_nothing;
+ }
+
return config->storage_area;
}
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index 1610d8166b..aae3d5ae82 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -51,11 +51,9 @@ void _CORE_message_queue_Close(
queue_context
);
- if ( the_message_queue->free_message_buffers != NULL ) {
- ( *the_message_queue->free_message_buffers )(
- the_message_queue->message_buffers
- );
- }
+ ( *the_message_queue->free_message_buffers )(
+ the_message_queue->message_buffers
+ );
_Thread_queue_Destroy( &the_message_queue->Wait_queue );
}