Bug fix: null ptr dereference in base/lock

Don't fail if nobody is holding the lock.
This commit is contained in:
Alexander Boettcher 2012-06-22 14:54:11 +02:00 committed by Norman Feske
parent f612475c99
commit f328f3786b

View File

@ -110,13 +110,14 @@ void Cancelable_lock::lock()
/* check if we are the applicant to be waken up next */
if (*_owner.applicant_to_wake_up() == myself) {
Applicant *a = _owner.applicant_to_wake_up();
if (a && (*a == myself)) {
_owner.applicant_to_wake_up(myself.applicant_to_wake_up());
/* otherwise, go through the list of remaining applicants */
} else {
Applicant *a = _owner.applicant_to_wake_up();
for (; a; a = a->applicant_to_wake_up()) {
/* remove reference to ourself from the applicants list */