aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-11-14 12:57:07 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commit1337f04122cac5f0343090ac23119e4133624db0 (patch)
treedeca829b52f5d02d8c2802d2540fc8b311f164ee /engines
parent8e8932f38d61789c76fd03a4a01e3cb74d3dc52d (diff)
downloadscummvm-rg350-1337f04122cac5f0343090ac23119e4133624db0.tar.gz
scummvm-rg350-1337f04122cac5f0343090ac23119e4133624db0.tar.bz2
scummvm-rg350-1337f04122cac5f0343090ac23119e4133624db0.zip
FULLPIPE: Fix memory leaks of SceneTag
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/objects.h4
-rw-r--r--engines/fullpipe/scene.cpp5
-rw-r--r--engines/fullpipe/stateloader.cpp8
3 files changed, 5 insertions, 12 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 78165c4f8d..7501f2bda7 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -23,6 +23,7 @@
#ifndef FULLPIPE_OBJECTS_H
#define FULLPIPE_OBJECTS_H
+#include "common/ptr.h"
#include "fullpipe/utils.h"
namespace Fullpipe {
@@ -34,12 +35,11 @@ class GameProject : public CObject {
public:
int _field_4;
Common::String _headerFilename;
- SceneTagList *_sceneTagList;
+ Common::ScopedPtr<SceneTagList> _sceneTagList;
int _field_10;
public:
GameProject();
- ~GameProject();
virtual bool load(MfcArchive &file);
};
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 46ad205278..6295e3b2d6 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -61,9 +61,8 @@ bool SceneTagList::load(MfcArchive &file) {
int numEntries = file.readUint16LE();
for (int i = 0; i < numEntries; i++) {
- SceneTag *t = new SceneTag();
- t->load(file);
- push_back(*t);
+ push_back(SceneTag());
+ back().load(file);
}
return true;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 34c2252c79..de10f2e34c 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -359,8 +359,6 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) {
GameProject::GameProject() {
_field_4 = 0;
_field_10 = 12;
-
- _sceneTagList = 0;
}
bool GameProject::load(MfcArchive &file) {
@@ -380,7 +378,7 @@ bool GameProject::load(MfcArchive &file) {
debugC(1, kDebugLoading, "_scrollSpeed = %d", g_fp->_scrollSpeed);
debugC(1, kDebugLoading, "_headerFilename = %s", _headerFilename.c_str());
- _sceneTagList = new SceneTagList();
+ _sceneTagList.reset(new SceneTagList());
_sceneTagList->load(file);
@@ -395,10 +393,6 @@ bool GameProject::load(MfcArchive &file) {
return true;
}
-GameProject::~GameProject() {
- delete _sceneTagList;
-}
-
GameVar::GameVar() {
_subVars = 0;
_parentVarObj = 0;