diff options
author | Christopher Page | 2008-06-03 18:24:54 +0000 |
---|---|---|
committer | Christopher Page | 2008-06-03 18:24:54 +0000 |
commit | fa75221e484d8649ab4506ec49b698328dd7649b (patch) | |
tree | 10b5e7b41110a1399e804daa239f66f3c8c26b44 /engines | |
parent | 0cbfc3a9d1b30822373360aa4c398518c9a74990 (diff) | |
download | scummvm-rg350-fa75221e484d8649ab4506ec49b698328dd7649b.tar.gz scummvm-rg350-fa75221e484d8649ab4506ec49b698328dd7649b.tar.bz2 scummvm-rg350-fa75221e484d8649ab4506ec49b698328dd7649b.zip |
PARA: Fixed some memory leaks
svn-id: r32519
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parser.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/parser.h | 6 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 2 |
6 files changed, 21 insertions, 29 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cd723181d9..25ebe4263d 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -84,18 +84,18 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam Parallaction::~Parallaction() { + clearSet(_commandOpcodes); + clearSet(_instructionOpcodes); + delete _debugger; - delete _globalTable; - delete _callableNames; - //delete _localFlagNames; freeLocation(); freeCharacter(); destroyInventory(); - + delete _localFlagNames; delete _gfx; delete _soundMan; @@ -138,9 +138,11 @@ int Parallaction::init() { } - - - +void Parallaction::clearSet(OpcodeSet &opcodes) { + for (Common::Array<const Opcode*>::iterator i = opcodes.begin(); i != opcodes.end(); ++i) + delete *i; + opcodes.clear(); +} void Parallaction::updateView() { @@ -534,10 +536,10 @@ void Character::free() { delete _objs; delete _ani->gfxobj; - _ani->gfxobj = NULL; _talk = NULL; _head = NULL; _objs = NULL; + _ani->gfxobj = NULL; return; } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 3117424373..b100342c2e 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -385,6 +385,9 @@ protected: // members int16 pickupItem(ZonePtr z); + void clearSet(OpcodeSet &opcodes); + + public: virtual void callFunction(uint index, void* parm) { } @@ -401,6 +404,7 @@ public: void beep(); + public: // const char **_zoneFlagNamesRes; // const char **_zoneTypeNamesRes; diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 74003ee78b..08599cb06b 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -154,7 +154,9 @@ int Parallaction_ns::init() { Parallaction_ns::~Parallaction_ns() { freeFonts(); - + + delete _locationParser; + delete _programParser; delete _mouseComposedArrow; _location._animations.remove(_char._ani); diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp index c166c8fe3a..6de0a7d7f5 100644 --- a/engines/parallaction/parser.cpp +++ b/engines/parallaction/parser.cpp @@ -30,10 +30,7 @@ namespace Parallaction { char _tokens[20][MAX_TOKEN_LEN]; -Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) { - -// clearAllTokens(); -} +Script::Script(Common::ReadStream *input, bool disposeSource) : _input(input), _disposeSource(disposeSource), _line(0) {} Script::~Script() { if (_disposeSource) @@ -75,17 +72,6 @@ void Script::clearTokens() { } -/* -void Script::clearAllTokens() { - - for (uint16 i = 0; i < 20; i++) - for (uint16 j = 0; j < 50; j++) - _tokens[i][j] = '\0'; - - return; -} -*/ - void Script::skip(const char* endToken) { while (scumm_stricmp(_tokens[0], endToken)) { diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index 79e9cc7df0..b6858ab175 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -44,7 +44,6 @@ class Script { uint _line; // for debug messages void clearTokens(); - //void clearAllTokens(); uint16 fillTokens(char* line); public: @@ -222,7 +221,6 @@ public: virtual ~LocationParser_ns() { delete _parser; - delete _script; delete _commandsNames; delete _locationStmt; delete _locationZoneStmt; @@ -230,8 +228,6 @@ public: delete _zoneTypeNames; delete _zoneFlagNames; - delete _parser; - clearSet(_commandParsers); clearSet(_locationAnimParsers); clearSet(_locationZoneParsers); @@ -361,7 +357,9 @@ public: } virtual ~ProgramParser_ns() { + delete _parser; delete _instructionNames; + clearSet(_instructionParsers); } diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 96a4fced71..1b66394abf 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -1396,7 +1396,7 @@ void LocationParser_ns::parseZone(ZoneList &list, char *name) { list.push_front(z); _parser->pushTables(&_locationZoneParsers, _locationZoneStmt); - + return; } |