Check size of queue before pushing.
This commit is contained in:
parent
b0c70231db
commit
aaabc3601b
|
@ -71,6 +71,9 @@ void msg_queue_free(msg_queue_t *queue)
|
||||||
|
|
||||||
void msg_queue_push(msg_queue_t *queue, const char *msg, unsigned prio, unsigned duration)
|
void msg_queue_push(msg_queue_t *queue, const char *msg, unsigned prio, unsigned duration)
|
||||||
{
|
{
|
||||||
|
if (queue->ptr >= queue->size)
|
||||||
|
return;
|
||||||
|
|
||||||
struct queue_elem *new_elem = calloc(1, sizeof(struct queue_elem));
|
struct queue_elem *new_elem = calloc(1, sizeof(struct queue_elem));
|
||||||
new_elem->prio = prio;
|
new_elem->prio = prio;
|
||||||
new_elem->duration = duration;
|
new_elem->duration = duration;
|
||||||
|
|
Loading…
Reference in New Issue