diff options
author | Willem Jan Palenstijn | 2016-02-02 01:21:28 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2016-02-02 01:21:28 +0100 |
commit | 75f1d2e2596035f603558dced17e64238032ce2c (patch) | |
tree | 4715b69554913f9c2e25e381d6dc61778334712e /engines/sword25/util/lua_unpersist.cpp | |
parent | 727ba4f2b1f20173e7a7f5ab6cb2910382785fe9 (diff) | |
download | scummvm-rg350-75f1d2e2596035f603558dced17e64238032ce2c.tar.gz scummvm-rg350-75f1d2e2596035f603558dced17e64238032ce2c.tar.bz2 scummvm-rg350-75f1d2e2596035f603558dced17e64238032ce2c.zip |
SWORD25: Use more appropriate function for growing the stack
The call to lua_growstack in unpersistThread would unconditionally at
least double the size of the stack. This caused memory usage to grow
exponentially (literally) with the number of serialized threads.
Bugs #6977, #6999.
Diffstat (limited to 'engines/sword25/util/lua_unpersist.cpp')
-rw-r--r-- | engines/sword25/util/lua_unpersist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/sword25/util/lua_unpersist.cpp b/engines/sword25/util/lua_unpersist.cpp index ef0ef31041..678ddb52db 100644 --- a/engines/sword25/util/lua_unpersist.cpp +++ b/engines/sword25/util/lua_unpersist.cpp @@ -425,7 +425,7 @@ void unpersistThread(UnSerializationInfo *info, int index) { // First, deserialize the object stack uint32 stackSize = info->readStream->readUint32LE(); - lua_growstack(info->luaState, (int)stackSize); + lua_checkstack(info->luaState, (int)stackSize); // Make sure that the first stack element (a nil, representing // the imaginary top-level C function) is written to the very, |