From 5df8ccc61cf9ad2c5e8bb3adfb84daf53d975170 Mon Sep 17 00:00:00 2001 From: rtel Date: Tue, 24 Dec 2013 10:47:52 +0000 Subject: [PATCH] Don't free xQueue->ucHead if it is NULL. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2140 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/queue.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index d33db5458..724c43864 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -126,13 +126,12 @@ typedef struct QueueDefinition { signed char *pcHead; /*< Points to the beginning of the queue storage area. */ signed char *pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */ - signed char *pcWriteTo; /*< Points to the free next place in the storage area. */ union /* Use of a union is an exception to the coding standard to ensure two mutually exclusive structure members don't appear simultaneously (wasting RAM). */ { signed char *pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */ - unsigned portBASE_TYPE uxRecursiveCallCount;/*< Maintains a count of the numebr of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ + unsigned portBASE_TYPE uxRecursiveCallCount;/*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ } u; xList xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */ @@ -1544,7 +1543,10 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; vQueueUnregisterQueue( pxQueue ); } #endif - vPortFree( pxQueue->pcHead ); + if( pxQueue->pcHead != NULL ) + { + vPortFree( pxQueue->pcHead ); + } vPortFree( pxQueue ); } /*-----------------------------------------------------------*/ -- 2.39.5