aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-11-16 22:30:25 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commitcef4d7787748fe8f0fae45d2573da4dfd4cc1c85 (patch)
tree1357d1a6175727c98ddac4c04337b40941096cdf
parentc7b1f6b26c0276f0d9dafb8c4ec4daac268d26c6 (diff)
downloadscummvm-rg350-cef4d7787748fe8f0fae45d2573da4dfd4cc1c85.tar.gz
scummvm-rg350-cef4d7787748fe8f0fae45d2573da4dfd4cc1c85.tar.bz2
scummvm-rg350-cef4d7787748fe8f0fae45d2573da4dfd4cc1c85.zip
FULLPIPE: Fix memory leaks of MctlItems in MctlCompound
-rw-r--r--engines/fullpipe/motion.cpp16
-rw-r--r--engines/fullpipe/motion.h9
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<MctlItem>());
+}
+
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<MctlConnectionPoint>());
}
-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<MctlItem *>, public CObject {
- public:
- virtual bool load(MfcArchive &file);
-};
-
class MctlCompound : public MotionController {
public:
- MctlCompoundArray _motionControllers;
+ /** list items are owned */
+ Common::Array<MctlItem *> _motionControllers;
MctlCompound() { _objtype = kObjTypeMctlCompound; }
+ virtual ~MctlCompound();
virtual bool load(MfcArchive &file);