From f050e2d66fd384c2d102152aa9371474b08e8664 Mon Sep 17 00:00:00 2001 From: David Turner Date: Sat, 29 Jan 2011 18:18:29 +0000 Subject: [PATCH] KYRA: Close Memory Leaks in Kyra 3 (Malcolm's Revenge) Menu. svn-id: r55618 --- engines/kyra/kyra_mr.cpp | 4 ++++ engines/kyra/kyra_v2.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 5ac6da9f2bd..b91eb42b477 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -121,6 +121,7 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi _curDlgChapter = _curDlgIndex = _curDlgLang = -1; _isStartupDialog = 0; _stringBuffer = 0; + _menuAnim = 0; _dialogSceneAnim = _dialogSceneScript = -1; memset(&_dialogScriptData, 0, sizeof(_dialogScriptData)); memset(&_dialogScriptState, 0, sizeof(_dialogScriptState)); @@ -155,6 +156,9 @@ KyraEngine_MR::~KyraEngine_MR() { delete _screen; delete _soundDigital; + delete _menuAnim; + _menuAnim = 0; + delete[] _itemBuffer1; delete[] _itemBuffer2; delete[] _scoreFile; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 53c57c21cdc..27c89ff9a36 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -74,6 +74,8 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi _pauseStart = 0; + _menu = 0; + _lang = 0; Common::Language lang = Common::parseLanguage(ConfMan.get("language")); if (lang == _flags.fanLang && _flags.replacedLang != Common::UNK_LANG) @@ -118,6 +120,9 @@ KyraEngine_v2::~KyraEngine_v2() { _emc->unload(&_sceneScriptData); + delete _menu; + _menu = 0; + delete[] _animObjects; for (Common::Array::iterator i = _opcodesAnimation.begin(); i != _opcodesAnimation.end(); ++i)