diff options
author | Thomas Fach-Pedersen | 2015-02-10 21:09:12 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-29 22:33:38 +0200 |
commit | da33169b75021d19f35867aca2b9322c1aec0005 (patch) | |
tree | 56a087fa9f554e1f272bbd6b15045fe3eb928d98 | |
parent | eba8ed5c6642cf3686c4fb7e28ceca9299e3a33a (diff) | |
download | scummvm-rg350-da33169b75021d19f35867aca2b9322c1aec0005.tar.gz scummvm-rg350-da33169b75021d19f35867aca2b9322c1aec0005.tar.bz2 scummvm-rg350-da33169b75021d19f35867aca2b9322c1aec0005.zip |
BLADERUNNER: Fix a couple of memory leaks
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 16 | ||||
-rw-r--r-- | engines/bladerunner/clues.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/scene.h | 5 | ||||
-rw-r--r-- | engines/bladerunner/text_resource.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/vqa_decoder.cpp | 1 |
5 files changed, 21 insertions, 4 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index d69a77c381..13ccae7fed 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -71,15 +71,22 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst) _settings = new Settings(this); _sliceAnimations = new SliceAnimations(this); _sliceRenderer = new SliceRenderer(this); + + _zBuffer1 = nullptr; + _zBuffer2 = nullptr; + + _actorNames = nullptr; } BladeRunnerEngine::~BladeRunnerEngine() { + delete _actorNames; + delete _sliceRenderer; delete _sliceAnimations; delete _settings; delete _script; delete _scene; - delete _gameVars; + delete[] _gameVars; delete _gameFlags; delete _gameInfo; delete _clues; @@ -90,6 +97,9 @@ BladeRunnerEngine::~BladeRunnerEngine() { _surface1.free(); _surface2.free(); + + delete[] _zBuffer1; + delete[] _zBuffer2; } bool BladeRunnerEngine::hasFeature(EngineFeature f) const { @@ -102,8 +112,10 @@ Common::Error BladeRunnerEngine::run() { _system->showMouse(true); - if (!startup()) + if (!startup()) { + shutdown(); return Common::Error(Common::kUnknownError, "Failed to initialize resources"); + } if (warnUserAboutUnsupportedGame()) { init2(); diff --git a/engines/bladerunner/clues.cpp b/engines/bladerunner/clues.cpp index cc47ae061b..5b1ce97256 100644 --- a/engines/bladerunner/clues.cpp +++ b/engines/bladerunner/clues.cpp @@ -45,6 +45,7 @@ Clues::Clues(BladeRunnerEngine *vm, const char *cluesResource, uint32 clueCount) } Clues::~Clues() { + delete _cluesText; delete[] _assetTypes; delete[] _crimes; } diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h index 3a71fb3bcd..f0721b39e3 100644 --- a/engines/bladerunner/scene.h +++ b/engines/bladerunner/scene.h @@ -61,7 +61,10 @@ public: _nextSetId(-1), _nextSceneId(-1), _playerWalkedIn(false) - { + {} + + ~Scene() { + delete _set; } bool open(int setId, int sceneId, bool isLoadingGame); diff --git a/engines/bladerunner/text_resource.cpp b/engines/bladerunner/text_resource.cpp index 9bb71fa53c..ce9e6f7866 100644 --- a/engines/bladerunner/text_resource.cpp +++ b/engines/bladerunner/text_resource.cpp @@ -50,7 +50,7 @@ bool TextResource::open(const char *name) { char resName[13]; sprintf(resName, "%s.TRE", name); - Common::SeekableReadStream *s = _vm->getResourceStream(resName); + Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(resName)); if (!s) return false; diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp index a6e7e7c76b..d1e56a98d6 100644 --- a/engines/bladerunner/vqa_decoder.cpp +++ b/engines/bladerunner/vqa_decoder.cpp @@ -571,6 +571,7 @@ VQADecoder::VQAVideoTrack::~VQAVideoTrack() { if (_surface) _surface->free(); delete _surface; + delete _zbuffer; } uint16 VQADecoder::VQAVideoTrack::getWidth() const { |