aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDavid Turner2010-11-30 00:01:54 +0000
committerDavid Turner2010-11-30 00:01:54 +0000
commit27a3173d939b52002584fca83ce4ba8c9e563db1 (patch)
tree4bff095b694e2a7d8a944eea15caf3dea28c70fe /engines
parent1fbd80b1e3eb442df2203d27269623c964a22bad (diff)
downloadscummvm-rg350-27a3173d939b52002584fca83ce4ba8c9e563db1.tar.gz
scummvm-rg350-27a3173d939b52002584fca83ce4ba8c9e563db1.tar.bz2
scummvm-rg350-27a3173d939b52002584fca83ce4ba8c9e563db1.zip
HUGO: Close Two Memory Leaks.
Note that the first leak is the allocation of the Common::RandomSource, _rnd. I'm not sure of the effect of deallocating this while it is still registered to g_eventRec, but all other engines seem to be the same (or implicitly do this by making a Common::RandomSource member of the engine object) so this is not a engine specific issue, but should be assessed. svn-id: r54659
Diffstat (limited to 'engines')
-rw-r--r--engines/hugo/hugo.cpp2
-rw-r--r--engines/hugo/object.cpp5
2 files changed, 7 insertions, 0 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index c3e4658e8b..a270ec773e 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -81,6 +81,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
_console = new HugoConsole(this);
+ _rnd = 0;
}
HugoEngine::~HugoEngine() {
@@ -167,6 +168,7 @@ HugoEngine::~HugoEngine() {
DebugMan.clearAllDebugChannels();
delete _console;
+ delete _rnd;
}
GameType HugoEngine::getGameType() const {
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index 15f5e4fe06..b8e1b34de5 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -343,7 +343,12 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
* Free ObjectArr (before exiting)
*/
void ObjectHandler::freeObjectArr() {
+ for(int16 i = 0; i < _objCount; i++) {
+ free(_objects[i].stateDataIndex);
+ _objects[i].stateDataIndex = 0;
+ }
free(_objects);
+ _objects = 0;
}
/**