diff options
author | Alyssa Milburn | 2011-06-20 17:42:00 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-06-20 17:42:00 +0200 |
commit | 6318758e7119d7834a9f7c4be11b819ee0bfaff4 (patch) | |
tree | f741c976e8ff428ed91c6de6e2fc61cbc2aaada5 /engines | |
parent | 0269a8d9008f51cca63ad215bbb2aa23ad75d574 (diff) | |
download | scummvm-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.cpp | 9 |
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; |