diff options
author | Paul Gilbert | 2010-06-14 04:20:57 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-06-14 04:20:57 +0000 |
commit | 466a151744618f89d6a0b53d23189af048d88831 (patch) | |
tree | 8e4075e281bcbc2ccb49894c441f28b281e59cf7 /engines/m4 | |
parent | ae0a7a667504b3356f2355aadfa6add722749ca6 (diff) | |
download | scummvm-rg350-466a151744618f89d6a0b53d23189af048d88831.tar.gz scummvm-rg350-466a151744618f89d6a0b53d23189af048d88831.tar.bz2 scummvm-rg350-466a151744618f89d6a0b53d23189af048d88831.zip |
Fixes for memory leaks reported by Valgrind
svn-id: r49643
Diffstat (limited to 'engines/m4')
-rw-r--r-- | engines/m4/graphics.cpp | 1 | ||||
-rw-r--r-- | engines/m4/m4.cpp | 1 | ||||
-rw-r--r-- | engines/m4/mads_scene.cpp | 7 | ||||
-rw-r--r-- | engines/m4/mads_views.cpp | 1 |
4 files changed, 8 insertions, 2 deletions
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index fc5cb0f9f9..36de60af6c 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -74,6 +74,7 @@ M4Surface::~M4Surface() { _madsVm->_palette->deleteRange(_rgbList); delete _rgbList; } + free(); } void M4Surface::loadCodesM4(Common::SeekableReadStream *source) { diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index a5db6660d8..c30e946653 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -147,6 +147,7 @@ MadsM4Engine::~MadsM4Engine() { delete _random; delete _palette; delete _globals; + delete _sound; delete _resourceManager; } diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp index d910340930..269f33878c 100644 --- a/engines/m4/mads_scene.cpp +++ b/engines/m4/mads_scene.cpp @@ -678,7 +678,9 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su Common::String s(buffer2, 64); setNames.push_back(s); } - + + delete stream; + // Initialise a copy of the surfaces if they weren't provided bool dsFlag = false, ssFlag = false; int gfxSize = width * height; @@ -696,6 +698,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su dsFlag = true; } + // For Rex Nebular, read in the scene's compressed walk surface information if (_vm->getGameType() == GType_RexNebular) { assert(depthSurface); @@ -712,7 +715,7 @@ void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Su destP += runLength; } - delete walkData; + free(walkData); delete stream; } diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp index 178fd90fd3..5c6c01293e 100644 --- a/engines/m4/mads_views.cpp +++ b/engines/m4/mads_views.cpp @@ -270,6 +270,7 @@ MadsTextDisplay::MadsTextDisplay(MadsView &owner): _owner(owner) { for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) { MadsTextDisplayEntry rec; rec.active = false; + rec.expire = 0; _entries.push_back(rec); } } |