Bug fix: null ptr dereference in base/semaphore

If nobody is blocked in a semaphore, nothing can be dequeued. If
the semaphore is used for signalling, there can be somebody in the queue,
but not necessarily.
This commit is contained in:
Alexander Boettcher 2012-06-22 14:46:39 +02:00 committed by Norman Feske
parent c873faa390
commit f612475c99

View File

@ -128,7 +128,9 @@ namespace Genode {
* Remove element from queue and wake up the corresponding
* blocking thread
*/
_queue.dequeue()->wake_up();
Semaphore_queue::Element * element = _queue.dequeue();
if (element)
element->wake_up();
}
void down()