Fix null deref in contextSwitch().

This commit is contained in:
Andreas Kling 2018-10-21 21:57:43 +02:00
commit dd6706a1a1
Notes: sideshowbarker 2024-07-19 18:46:02 +09:00

View file

@ -360,6 +360,7 @@ static bool contextSwitch(Task* t)
if (current == t) if (current == t)
return false; return false;
if (current) {
// If the last task hasn't blocked (still marked as running), // If the last task hasn't blocked (still marked as running),
// mark it as runnable for the next round. // mark it as runnable for the next round.
if (current->state() == Task::Running) if (current->state() == Task::Running)
@ -367,7 +368,9 @@ static bool contextSwitch(Task* t)
bool success = MemoryManager::the().unmapRegionsForTask(*current); bool success = MemoryManager::the().unmapRegionsForTask(*current);
ASSERT(success); ASSERT(success);
success = MemoryManager::the().mapRegionsForTask(*t); }
bool success = MemoryManager::the().mapRegionsForTask(*t);
ASSERT(success); ASSERT(success);
current = t; current = t;