aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlyssa Milburn2011-06-20 17:42:00 +0200
committerAlyssa Milburn2011-06-20 17:42:00 +0200
commit6318758e7119d7834a9f7c4be11b819ee0bfaff4 (patch)
treef741c976e8ff428ed91c6de6e2fc61cbc2aaada5 /engines
parent0269a8d9008f51cca63ad215bbb2aa23ad75d574 (diff)
downloadscummvm-rg350-6318758e7119d7834a9f7c4be11b819ee0bfaff4.tar.gz
scummvm-rg350-6318758e7119d7834a9f7c4be11b819ee0bfaff4.tar.bz2
scummvm-rg350-6318758e7119d7834a9f7c4be11b819ee0bfaff4.zip
TINSEL: Don't leak running processes in Scheduler::reset().
Diffstat (limited to 'engines')
-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;