diff options
author | Filippos Karapetis | 2010-12-21 21:18:25 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-12-21 21:18:25 +0000 |
commit | 42dc70bb83ecf36ea27c1c2d411d479a4d21d254 (patch) | |
tree | a102e26769fd82109a98d94d00dbac8781731f1f /engines | |
parent | 7680ed0be7e6d726fd25ba06506cb7fe9e8ea2ca (diff) | |
download | scummvm-rg350-42dc70bb83ecf36ea27c1c2d411d479a4d21d254.tar.gz scummvm-rg350-42dc70bb83ecf36ea27c1c2d411d479a4d21d254.tar.bz2 scummvm-rg350-42dc70bb83ecf36ea27c1c2d411d479a4d21d254.zip |
- SCI: Added code to free the _baseVars value in SCI3 as well. Both free() operations
have been commented out for now, as MSVC complains about heap corruption in SCI3 games
- Code formatting fixes
svn-id: r54991
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/object.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/object.h | 13 |
2 files changed, 16 insertions, 7 deletions
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp index ed78a5fc2d..99527b5d1a 100644 --- a/engines/sci/engine/object.cpp +++ b/engines/sci/engine/object.cpp @@ -61,13 +61,13 @@ void Object::init(byte *buf, reg_t obj_pos, bool initVariables) { if (getSciVersion() <= SCI_VERSION_1_LATE) { _variables.resize(READ_LE_UINT16(data + kOffsetSelectorCounter)); - _baseVars = (const uint16 *)(_baseObj + _variables.size() * 2); + _baseVars = (uint16 *)(_baseObj + _variables.size() * 2); _methodCount = READ_LE_UINT16(data + READ_LE_UINT16(data + kOffsetFunctionArea) - 2); _baseMethod = Common::Array<uint16>((const uint16 *)(data + READ_LE_UINT16(data + kOffsetFunctionArea)), _methodCount*2+2); } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) { _variables.resize(READ_SCI11ENDIAN_UINT16(data + 2)); - _baseVars = (const uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4)); + _baseVars = (uint16 *)(buf + READ_SCI11ENDIAN_UINT16(data + 4)); _methodCount = READ_SCI11ENDIAN_UINT16(buf + READ_SCI11ENDIAN_UINT16(data + 6)); _baseMethod = Common::Array<uint16>((const uint16 *) (buf + READ_SCI11ENDIAN_UINT16(data + 6)), _methodCount*2+3); @@ -222,9 +222,9 @@ void Object::initSelectorsSci3(const byte *buf) { } _variables.resize(properties); - uint16 *propertyIds = (uint16*) malloc(sizeof(uint16)*properties); -// uint16 *methodOffsets = (uint16*) malloc(sizeof(uint16)*2*methods); - uint16 *propertyOffsets = (uint16*) malloc(sizeof(uint16)*properties); + uint16 *propertyIds = (uint16 *) malloc(sizeof(uint16) * properties); +// uint16 *methodOffsets = (uint16 *) malloc(sizeof(uint16) * 2 * methods); + uint16 *propertyOffsets = (uint16 *) malloc(sizeof(uint16) * properties); int propertyCounter = 0; int methodCounter = 0; diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h index f59874bb44..81d5b2c983 100644 --- a/engines/sci/engine/object.h +++ b/engines/sci/engine/object.h @@ -69,7 +69,16 @@ public: _propertyOffsetsSci3 = 0; } - ~Object() { free(_propertyOffsetsSci3); } + ~Object() { + if (getSciVersion() == SCI_VERSION_3) { + // FIXME: memory leak! Commented out because of reported heap + // corruption by MSVC (e.g. in LSL7, when it starts) + //free(_baseVars); + //_baseVars = 0; + //free(_propertyOffsetsSci3); + //_propertyOffsetsSci3 = 0; + } + } reg_t getSpeciesSelector() const { if (getSciVersion() <= SCI_VERSION_2_1) @@ -229,7 +238,7 @@ private: void initSelectorsSci3(const byte *buf); const byte *_baseObj; /**< base + object offset within base */ - const uint16 *_baseVars; /**< Pointer to the varselector area for this object */ + uint16 *_baseVars; /**< Pointer to the varselector area for this object */ Common::Array<uint16> _baseMethod; /**< Pointer to the method selector area for this object */ uint16 *_propertyOffsetsSci3; /**< This is used to enable relocation of property valuesa in SCI3 */ |