From cef4d7787748fe8f0fae45d2573da4dfd4cc1c85 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 16 Nov 2017 22:30:25 -0600 Subject: FULLPIPE: Fix memory leaks of MctlItems in MctlCompound --- engines/fullpipe/motion.cpp | 16 ++++------------ engines/fullpipe/motion.h | 9 +++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 7c46d1756c..a6c55bfd40 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -105,6 +105,10 @@ MovGraphLink *MotionController::getLinkByName(const char *name) { return 0; } +MctlCompound::~MctlCompound() { + Common::for_each(_motionControllers.begin(), _motionControllers.end(), Common::DefaultDeleter()); +} + bool MctlCompound::load(MfcArchive &file) { debugC(5, kDebugLoading, "MctlCompound::load()"); @@ -731,18 +735,6 @@ MctlItem::~MctlItem() { Common::for_each(_connectionPoints.begin(), _connectionPoints.end(), Common::DefaultDeleter()); } -bool MctlCompoundArray::load(MfcArchive &file) { - debugC(5, kDebugLoading, "MctlCompoundArray::load()"); - - int count = file.readUint32LE(); - - debugC(0, kDebugLoading, "MctlCompoundArray::count = %d", count); - - assert(0); - - return true; -} - MovGraphItem::MovGraphItem() { ani = 0; field_4 = 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index b47cff9a13..f71d58a38d 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -92,16 +92,13 @@ public: ~MctlItem(); }; -class MctlCompoundArray : public Common::Array, public CObject { - public: - virtual bool load(MfcArchive &file); -}; - class MctlCompound : public MotionController { public: - MctlCompoundArray _motionControllers; + /** list items are owned */ + Common::Array _motionControllers; MctlCompound() { _objtype = kObjTypeMctlCompound; } + virtual ~MctlCompound(); virtual bool load(MfcArchive &file); -- cgit v1.2.3