diff options
author | Colin Snover | 2017-05-20 16:34:32 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-20 21:14:18 -0500 |
commit | ef69a594672bb1e6549269ca695d6feae3a9c579 (patch) | |
tree | bd01e138894559e5f145ab500592c1fb595da6ef /engines/sci/engine/script.h | |
parent | bc728a1c939b7a753af5885ff42860dde1b0da5d (diff) | |
download | scummvm-rg350-ef69a594672bb1e6549269ca695d6feae3a9c579.tar.gz scummvm-rg350-ef69a594672bb1e6549269ca695d6feae3a9c579.tar.bz2 scummvm-rg350-ef69a594672bb1e6549269ca695d6feae3a9c579.zip |
SCI: Stop leaking locals segments during script reuse
When a game deletes a script and then loads the same script again
before it has been fully deallocated,
SegManager::instantiateScript tries to reuse the same script
& locals segments, but it was failing to reuse the old locals
segment because Script::freeScript would unconditionally clear
the old locals SegmentId, which meant the old locals segment would
just leak.
This patch does not fix old save games which may contain orphaned
locals segments, but should prevent the problem from occurring
going forward. (It is possible to clean up these old save games,
but this is not a big leak so it doesn't seem worth the extra
effort to do so.)
Diffstat (limited to 'engines/sci/engine/script.h')
-rw-r--r-- | engines/sci/engine/script.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index b59f87f13a..1befef1c8a 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -132,7 +132,7 @@ public: Script(); ~Script(); - void freeScript(); + void freeScript(const bool keepLocalsSegment = false); void load(int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher); virtual bool isValidOffset(uint32 offset) const; |