Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NULL pointer check. (#313)

* Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NULL pointer check.

Fixes FreeRTOS/FreeRTOS-Kernel#311

* Make NULL checks consistent.
This commit is contained in:
Paul Bartell 2021-04-17 09:57:16 -07:00 committed by GitHub
parent 99295c9ae8
commit 46f7feba81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

38
queue.c
View file

@ -2728,32 +2728,34 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
UBaseType_t ux; UBaseType_t ux;
configASSERT( xQueue ); configASSERT( xQueue );
configASSERT( pcQueueName );
QueueRegistryItem_t * pxEntryToWrite = NULL; QueueRegistryItem_t * pxEntryToWrite = NULL;
/* See if there is an empty space in the registry. A NULL name denotes if( pcQueueName != NULL )
* a free slot. */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{ {
/* Replace an existing entry if the queue is already in the registry. */ /* See if there is an empty space in the registry. A NULL name denotes
if( xQueueRegistry[ ux ].xHandle == xQueue ) * a free slot. */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{ {
pxEntryToWrite = &( xQueueRegistry[ ux ] ); /* Replace an existing entry if the queue is already in the registry. */
break; if( xQueue == xQueueRegistry[ ux ].xHandle )
} {
/* Otherwise, store in the next empty location */ pxEntryToWrite = &( xQueueRegistry[ ux ] );
else if( ( NULL == pxEntryToWrite ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) ) break;
{ }
pxEntryToWrite = &( xQueueRegistry[ ux ] ); /* Otherwise, store in the next empty location */
} else if( ( pxEntryToWrite == NULL ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
else {
{ pxEntryToWrite = &( xQueueRegistry[ ux ] );
mtCOVERAGE_TEST_MARKER(); }
else
{
mtCOVERAGE_TEST_MARKER();
}
} }
} }
if( NULL != pxEntryToWrite ) if( pxEntryToWrite == NULL )
{ {
/* Store the information on this queue. */ /* Store the information on this queue. */
pxEntryToWrite->pcQueueName = pcQueueName; pxEntryToWrite->pcQueueName = pcQueueName;