From e40b4a348a8beb91fe97aa97f6e2323e78b3e10e Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 18 Nov 2017 10:58:46 -0600 Subject: FULLPIPE: Fix memory leaks of arcade keys Fixes Trac#9657. --- engines/fullpipe/fullpipe.h | 2 +- engines/fullpipe/input.cpp | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'engines/fullpipe') diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index a24f11e889..cd7b120952 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -223,7 +223,7 @@ public: Common::ScopedPtr _floaters; Common::ScopedPtr _aniHandler; - Common::Array _arcadeKeys; + Common::Array _arcadeKeys; void initMap(); void updateMap(PreloadItem *pre); diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp index d692f87366..3b733b9eab 100644 --- a/engines/fullpipe/input.cpp +++ b/engines/fullpipe/input.cpp @@ -262,16 +262,12 @@ void FullpipeEngine::initArcadeKeys(const char *varname) { return; int cnt = var->getSubVarsCount(); - + _arcadeKeys.resize(cnt); for (int i = 0; i < cnt; i++) { - Common::Point *point = new Common::Point; - + Common::Point &point = _arcadeKeys[i]; GameVar *sub = var->getSubVarByIndex(i); - - point->x = sub->getSubVarAsInt("X"); - point->y = sub->getSubVarAsInt("Y"); - - _arcadeKeys.push_back(point); + point.x = sub->getSubVarAsInt("X"); + point.y = sub->getSubVarAsInt("Y"); } } @@ -283,7 +279,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { if (cmd->_sceneClickX <= g_fp->_aniMan2->_ox) { for (idx = (int)_arcadeKeys.size() - 1; idx >= 0; idx--) { - if (_arcadeKeys[idx]->x < g_fp->_aniMan2->_ox) + if (_arcadeKeys[idx].x < g_fp->_aniMan2->_ox) break; } @@ -291,7 +287,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { return; } else { for (idx = 0; idx < (int)_arcadeKeys.size(); idx++) { - if (_arcadeKeys[idx]->x > g_fp->_aniMan2->_ox) + if (_arcadeKeys[idx].x > g_fp->_aniMan2->_ox) break; } @@ -299,8 +295,8 @@ void FullpipeEngine::processArcade(ExCommand *cmd) { return; } - cmd->_sceneClickX = _arcadeKeys[idx]->x; - cmd->_sceneClickY = _arcadeKeys[idx]->y; + cmd->_sceneClickX = _arcadeKeys[idx].x; + cmd->_sceneClickY = _arcadeKeys[idx].y; cmd->_x = cmd->_sceneClickX - g_fp->_sceneRect.left; cmd->_y = cmd->_sceneClickY - g_fp->_sceneRect.top; -- cgit v1.2.3