aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tinsel/sched.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp
index b24d6bf9b8..d6cd806eb2 100644
--- a/engines/tinsel/sched.cpp
+++ b/engines/tinsel/sched.cpp
@@ -70,6 +70,7 @@ Scheduler::Scheduler() {
active = new PROCESS;
active->pPrevious = NULL;
+ active->pNext = NULL;
g_scheduler = this; // FIXME HACK
}
@@ -113,6 +114,14 @@ void Scheduler::reset() {
memset(processList, 'S', MAX_PROCESSES * sizeof(PROCESS));
}
+ // Kill all running processes (i.e. free memory allocated for their state).
+ PROCESS *pProc = active->pNext;
+ while (pProc != NULL) {
+ delete pProc->state;
+ pProc->state = 0;
+ pProc = pProc->pNext;
+ }
+
// no active processes
pCurrent = active->pNext = NULL;