From 5b3209ea19a04e87faa81add6f708819cba661fb Mon Sep 17 00:00:00 2001 From: Oliver Hahm Date: Mon, 1 Nov 2010 13:29:40 +0100 Subject: [PATCH] * check for null pointer in mutex wake waiters function --- core/mutex.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/mutex.c b/core/mutex.c index be33fba931..b337a85fbe 100644 --- a/core/mutex.c +++ b/core/mutex.c @@ -103,6 +103,13 @@ void mutex_wake_waiters(struct mutex_t *mutex, int flags) { DEBUG("%s: waking up waiters.\n", active_thread->name); queue_node_t *next = queue_remove_head(&(mutex->queue)); + + /* queue is empty */ + if (!next) { + mutex->val = 0; + return; + } + tcb* process = (tcb*)next->data; sched_set_status(process, STATUS_PENDING);