# Bad assert in queue.c xQueueGenericCreate

**URL:** <https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407>\
**Category:** Kernel\
**Created:** [September 10, 2015, 3:07pm UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407 "2015-09-10T15:07:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 10, 2015, 3:07pm UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407/1 "2015-09-10T15:07:00Z")

</div>

**[hairymnstr](https://sourceforge.net/u/hairymnstr/)** wrote on [Thursday, September 10, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/f1ed98f6/#db73):

In queue.c from FreeRTOS 8.2.2 the xQueueGenericCreate function ends (see line 383 on) with:

```
configASSERT( xReturn );

return xReturn;

```

so it’s impossible for the function to return NULL without triggering the assertion. However the documentation ([http://www.freertos.org/a00116.html](http://www.freertos.org/a00116.html)) states that xQueueCreate _can_ return 0 to indicate failure.

If assertions were turned off this function would operate as documented, so it seems like this assert should not be present.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [September 10, 2015, 4:21pm UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407/2 "2015-09-10T16:21:23Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, September 10, 2015](https://sourceforge.net/p/freertos/discussion/382005/thread/f1ed98f6/#00bc):

Its gone! [but the change is not checked in yet]

If you have a malloc failed hook defined then that will get called anyway, so it was perhaps a little obsolete.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 23, 2016, 10:53am UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407/3 "2016-03-23T10:53:37Z")

</div>

**[hairymnstr](https://sourceforge.net/u/hairymnstr/)** wrote on [Wednesday, March 23, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f1ed98f6/#c151):

Looks like this change never got checked in, I’m still seeing this assert in 8.2.3 and 9.0.0rc1

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 23, 2016, 11:20am UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407/4 "2016-03-23T11:20:41Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Wednesday, March 23, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f1ed98f6/#c151/8c6f):

Look at the definitions of xQueueGenericCreate() and  
xQueueGenericCreateStatic() in the head revision (lines 384 and 332 at  
the time of posting) - the assert was removed, but after rc1. Since rc1  
some simplification of the static allocation code has been made.

[https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/queue.c](https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/queue.c)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 23, 2016, 11:53am UTC](https://forums.freertos.org/t/bad-assert-in-queue-c-xqueuegenericcreate/5407/5 "2016-03-23T11:53:30Z")

</div>

**[hairymnstr](https://sourceforge.net/u/hairymnstr/)** wrote on [Wednesday, March 23, 2016](https://sourceforge.net/p/freertos/discussion/382005/thread/f1ed98f6/#c151/8c6f/52fb):

Excellent, thanks. Another reason to look forward to 9.0.0!
