From 68ed8b95989d784fe42f4e6e400224ffb63ba80b Mon Sep 17 00:00:00 2001 From: athrxx Date: Tue, 13 Sep 2011 21:46:23 +0200 Subject: KYRA: (EOB) - fix some valgrind warnings --- engines/kyra/eobcommon.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'engines/kyra/eobcommon.cpp') diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index 802907eba5..3bc145a398 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -183,7 +183,7 @@ EobCoreEngine::~EobCoreEngine() { delete[] _itemTypes; if (_itemNames) { for (int i = 0; i < 130; i++) - delete _itemNames[i]; + delete[] _itemNames[i]; } delete[] _itemNames; delete[] _flyingObjects; @@ -218,6 +218,9 @@ EobCoreEngine::~EobCoreEngine() { delete _gui; _gui = 0; + delete _screen; + _screen = 0; + delete[] _menuDefs; _menuDefs = 0; @@ -227,6 +230,8 @@ EobCoreEngine::~EobCoreEngine() { _timer = 0; delete _debugger; _debugger = 0; + delete _txt; + _txt = 0; } Common::Error EobCoreEngine::init() { @@ -672,6 +677,8 @@ void EobCoreEngine::releaseItemsAndDecorationsShapes() { delete []_firebeamShapes; } + delete[] _redSplatShape; + delete[] _greenSplatShape; delete[] _deadCharShape; delete[] _disabledCharGrid; delete[] _blackBoxSmallGrid; @@ -1214,18 +1221,15 @@ void EobCoreEngine::setWeaponSlotStatus(int charIndex, int mode, int slot) { gui_drawCharPortraitWithStats(charIndex); } -void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, ...) { +void EobCoreEngine::setupDialogueButtons(int presetfirst, int numStr, const char *str1, va_list &args) { _dialogueNumButtons = numStr; _dialogueButtonString[0] = str1; _dialogueHighlightedButton = 0; - va_list args; - va_start(args, str1); - const char **sp = va_arg(args, const char**); - va_end(args); for (int i = 1; i < numStr; i++) { - if (sp[i - 1]) - _dialogueButtonString[i] = sp[i - 1]; + const char *tmp = va_arg(args, const char*); + if (tmp) + _dialogueButtonString[i] = tmp; else _dialogueNumButtons = numStr = i; } -- cgit v1.2.3