aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/statics.cpp9
-rw-r--r--engines/fullpipe/utils.cpp5
2 files changed, 5 insertions, 9 deletions
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 289dfa9c0c..223cc8c6d6 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -222,17 +222,14 @@ bool StaticANIObject::load(MfcArchive &file) {
Common::String movname = genFileName(_id, movNum, "mov");
- Common::SeekableReadStream *f = g_fp->_currArchive->createReadStreamForMember(movname);
+ Common::ScopedPtr<Common::SeekableReadStream> f(g_fp->_currArchive->createReadStreamForMember(movname));
Movement *mov = new Movement();
+ _movements.push_back(mov);
- MfcArchive archive(f);
+ MfcArchive archive(f.get());
mov->load(archive, this);
-
- _movements.push_back(mov);
-
- delete f;
}
Common::Point pt;
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 02b235ae32..72a3377f74 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -24,6 +24,7 @@
#include "common/file.h"
#include "common/memstream.h"
+#include "common/ptr.h"
#include "fullpipe/objects.h"
#include "fullpipe/motion.h"
@@ -166,7 +167,7 @@ void MemoryObject::loadFile(const Common::String &filename) {
if (g_fp->_currArchive != _libHandle && _libHandle)
g_fp->_currArchive = _libHandle;
- Common::SeekableReadStream *s = g_fp->_currArchive->createReadStreamForMember(filename);
+ Common::ScopedPtr<Common::SeekableReadStream> s(g_fp->_currArchive->createReadStreamForMember(filename));
if (s) {
assert(s->size() > 0);
@@ -176,8 +177,6 @@ void MemoryObject::loadFile(const Common::String &filename) {
debugC(5, kDebugLoading, "Loading %s (%d bytes)", filename.c_str(), _dataSize);
_data = (byte *)calloc(_dataSize, 1);
s->read(_data, _dataSize);
-
- delete s;
} else {
// We have no object to read. This is fine
}