aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-06-10 04:21:01 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit0659ca4846d6b7eade11628e35c6dad6bf876e49 (patch)
tree48d2952620940c78644ce180dad81c7ac98f7467
parentf11d3311296aa3afd8f54e4458cb900fdf417782 (diff)
downloadscummvm-rg350-0659ca4846d6b7eade11628e35c6dad6bf876e49.tar.gz
scummvm-rg350-0659ca4846d6b7eade11628e35c6dad6bf876e49.tar.bz2
scummvm-rg350-0659ca4846d6b7eade11628e35c6dad6bf876e49.zip
PINK: fix mem leaks
-rw-r--r--engines/pink/objects/pages/game_page.cpp1
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp4
-rw-r--r--engines/pink/objects/walk/walk_mgr.cpp6
-rw-r--r--engines/pink/objects/walk/walk_mgr.h1
-rw-r--r--engines/pink/pink.cpp1
-rw-r--r--engines/pink/sound.cpp2
6 files changed, 14 insertions, 1 deletions
diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp
index 5bd420c442..e0d5de1c3c 100644
--- a/engines/pink/objects/pages/game_page.cpp
+++ b/engines/pink/objects/pages/game_page.cpp
@@ -36,6 +36,7 @@ GamePage::GamePage()
GamePage::~GamePage() {
clear();
+ delete _memFile;
}
void GamePage::toConsole() {
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 8facfe32e9..30048814fb 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -40,6 +40,10 @@ Sequencer::~Sequencer() {
for (uint i = 0; i < _sequences.size(); ++i) {
delete _sequences[i];
}
+ for (uint i = 0; i < _timers.size(); ++i) {
+ delete _timers[i];
+ }
+ removeContext(_context);
}
void Sequencer::deserialize(Archive &archive) {
diff --git a/engines/pink/objects/walk/walk_mgr.cpp b/engines/pink/objects/walk/walk_mgr.cpp
index c7c06ec474..1336991aba 100644
--- a/engines/pink/objects/walk/walk_mgr.cpp
+++ b/engines/pink/objects/walk/walk_mgr.cpp
@@ -32,6 +32,12 @@ namespace Pink {
WalkMgr::WalkMgr()
: _isWalking(false), _leadActor(nullptr) {}
+WalkMgr::~WalkMgr() {
+ for (uint i = 0; i < _locations.size(); ++i) {
+ delete _locations[i];
+ }
+}
+
void WalkMgr::deserialize(Pink::Archive &archive) {
_leadActor = static_cast<LeadActor *>(archive.readObject());
_locations.deserialize(archive);
diff --git a/engines/pink/objects/walk/walk_mgr.h b/engines/pink/objects/walk/walk_mgr.h
index cb6b68c31c..a836bfc522 100644
--- a/engines/pink/objects/walk/walk_mgr.h
+++ b/engines/pink/objects/walk/walk_mgr.h
@@ -42,6 +42,7 @@ struct Coordinates {
class WalkMgr : public Object {
public:
WalkMgr();
+ ~WalkMgr() override;
virtual void deserialize(Archive &archive);
void toConsole() override;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index eaeadbcd2e..d28b05828d 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -261,6 +261,7 @@ Common::Error PinkEngine::loadGameState(int slot) {
_nextPage = archive.readString();
initModule(archive.readString(), "", &archive);
+ delete in;
return Common::kNoError;
}
diff --git a/engines/pink/sound.cpp b/engines/pink/sound.cpp
index 81463b29bf..5771951e3e 100644
--- a/engines/pink/sound.cpp
+++ b/engines/pink/sound.cpp
@@ -39,7 +39,7 @@ void Sound::play(Common::SafeSeekableSubReadStream *stream, Audio::Mixer::SoundT
mixer->stopHandle(_handle);
Audio::AudioStream *audioStream;
- Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::NO);
+ Audio::SeekableAudioStream *wavStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
if (isLoop)
audioStream = Audio::makeLoopingAudioStream(wavStream, 0, 0, 0);
else