From 8a0d0667e3c0c83e473f22f309a69beb44ebe57e Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 29 Sep 2014 17:25:52 +1000 Subject: [PATCH] Check for initialised ckmsgq when checking if the queue is empty --- src/ckpool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 21802096..e6fc2a9a 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -165,10 +165,11 @@ void ckmsgq_add(ckmsgq_t *ckmsgq, void *data) /* Return whether there are any messages queued in the ckmsgq linked list. */ bool ckmsgq_empty(ckmsgq_t *ckmsgq) { - bool ret; + bool ret = true; mutex_lock(&ckmsgq->lock); - ret = (ckmsgq->msgs->next == ckmsgq->msgs->prev); + if (ckmsgq->msgs) + ret = (ckmsgq->msgs->next == ckmsgq->msgs->prev); mutex_unlock(&ckmsgq->lock); return ret;