diff options
author | Nicola Mettifogo | 2007-05-21 21:06:30 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-05-21 21:06:30 +0000 |
commit | 7d2809108e9a4c89d7d17e87539d893458a5e3b4 (patch) | |
tree | 9e80a7186f5ca22292f6480820d35b32efb00208 /engines | |
parent | 8bc84330596829f129e9c00ca2c1711f73685cb6 (diff) | |
download | scummvm-rg350-7d2809108e9a4c89d7d17e87539d893458a5e3b4.tar.gz scummvm-rg350-7d2809108e9a4c89d7d17e87539d893458a5e3b4.tar.bz2 scummvm-rg350-7d2809108e9a4c89d7d17e87539d893458a5e3b4.zip |
Fixed the largest memory leaks.
svn-id: r26905
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/graphics.cpp | 3 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/inventory.h | 1 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 8 |
5 files changed, 24 insertions, 5 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 388547e751..e11edf06c0 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -852,6 +852,9 @@ Gfx::~Gfx() { delete _fonts[kFontLabel]; delete _fonts[kFontMenu]; + freeStaticCnv(_mouseComposedArrow); + delete _mouseComposedArrow; + return; } diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 39a89db580..52dbd50db0 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -339,6 +339,12 @@ void initInventory() { _buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT); } +void destroyInventory() { + if (_buffer) + free(_buffer); + _buffer = 0; +} + void cleanInventory() { for (uint16 slot = INVENTORY_FIRST_ITEM; slot < INVENTORY_MAX_ITEMS; slot++) { diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index 89ec6db01e..36ea39ed03 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -41,6 +41,7 @@ struct InventoryItem { extern InventoryItem _inventory[]; void initInventory(); +void destroyInventory(); void openInventory(); void closeInventory(); int16 isItemInInventory(int32 v); diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index da67c556af..012e351ab5 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -179,9 +179,14 @@ void Parallaction::freeLocation() { if (_localFlagNames) delete _localFlagNames; - _localFlagNames = new Table(120); - _localFlagNames->addData("visited"); - + + // HACK: prevents leakage. A routine like this + // should allocate memory at all, though. + if ((_engineFlags & kEngineQuit) == 0) { + _localFlagNames = new Table(120); + _localFlagNames->addData("visited"); + } + _location._walkNodes.clear(); // TODO (LIST): helperNode should be rendered useless by the use of a Common::List<> diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 4e45bc4f90..1cf285ba57 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -140,6 +140,10 @@ Parallaction::~Parallaction() { delete _localFlagNames; delete _gfx; + + freeLocation(); + freeCharacter(); + destroyInventory(); } @@ -304,7 +308,7 @@ uint16 Parallaction::updateInput() { break; case Common::EVENT_QUIT: - _system->quit(); + _engineFlags |= kEngineQuit; break; default: @@ -334,7 +338,7 @@ void waitUntilLeftClick() { break; if (e.type == Common::EVENT_QUIT) { - g_system->quit(); + _engineFlags |= kEngineQuit; break; } |