diff --git a/engines/grim/bitmap.cpp b/engines/grim/bitmap.cpp index 9072b2b3587..ddf78ec13ec 100644 --- a/engines/grim/bitmap.cpp +++ b/engines/grim/bitmap.cpp @@ -124,7 +124,6 @@ BitmapData::BitmapData(const Common::String &fname, Common::SeekableReadStream * Debug::error(Debug::Bitmaps, "Invalid magic loading bitmap"); break; } - delete data; } diff --git a/engines/grim/colormap.cpp b/engines/grim/colormap.cpp index 60e3211342f..63f5f0acc36 100644 --- a/engines/grim/colormap.cpp +++ b/engines/grim/colormap.cpp @@ -34,7 +34,6 @@ CMap::CMap(const Common::String &fileName, Common::SeekableReadStream *data) : data->seek(64, SEEK_SET); data->read(_colors, sizeof(_colors)); - delete data; } CMap::~CMap() { diff --git a/engines/grim/costume.cpp b/engines/grim/costume.cpp index 080292156b4..f5edf718768 100644 --- a/engines/grim/costume.cpp +++ b/engines/grim/costume.cpp @@ -116,7 +116,6 @@ Costume::Costume(const Common::String &fname, Common::SeekableReadStream *data, TextSplitter ts(data); loadGRIM(ts, prevCost); } - delete data; } void Costume::loadGRIM(TextSplitter &ts, Costume *prevCost) { diff --git a/engines/grim/font.cpp b/engines/grim/font.cpp index ac6702ed585..f036cd933f7 100644 --- a/engines/grim/font.cpp +++ b/engines/grim/font.cpp @@ -97,7 +97,6 @@ void Font::load(const Common::String &filename, Common::SeekableReadStream *data data->read(_fontData, _dataSize); g_driver->createFont(this); - delete data; } uint16 Font::getCharIndex(unsigned char c) const { diff --git a/engines/grim/grim.cpp b/engines/grim/grim.cpp index a43db8d5414..7476b7c77ac 100644 --- a/engines/grim/grim.cpp +++ b/engines/grim/grim.cpp @@ -963,6 +963,7 @@ Set *GrimEngine::loadSet(const Common::String &name) { warning("Could not find scene file %s", name.c_str()); s = new Set(name, stream); + delete stream; } return s; diff --git a/engines/grim/keyframe.cpp b/engines/grim/keyframe.cpp index befe8dab7ac..453c2ca54f4 100644 --- a/engines/grim/keyframe.cpp +++ b/engines/grim/keyframe.cpp @@ -44,7 +44,6 @@ KeyframeAnim::KeyframeAnim(const Common::String &fname, Common::SeekableReadStre TextSplitter ts(data); loadText(ts); } - delete data; } void KeyframeAnim::loadBinary(Common::SeekableReadStream *data) { diff --git a/engines/grim/lipsync.cpp b/engines/grim/lipsync.cpp index 3d0ecb8c48c..0153a98d7a4 100644 --- a/engines/grim/lipsync.cpp +++ b/engines/grim/lipsync.cpp @@ -77,7 +77,6 @@ LipSync::LipSync(const Common::String &filename, Common::SeekableReadStream *dat } } - delete data; } LipSync::~LipSync() { diff --git a/engines/grim/material.cpp b/engines/grim/material.cpp index d7f3c362cf2..ea77d587ee6 100644 --- a/engines/grim/material.cpp +++ b/engines/grim/material.cpp @@ -81,7 +81,6 @@ void MaterialData::initGrim(const Common::String &filename, Common::SeekableRead data->seek(12, SEEK_CUR); data->read(t->_data, t->_width * t->_height); } - delete data; } void loadTGA(Common::SeekableReadStream *data, Texture *t) { diff --git a/engines/grim/model.cpp b/engines/grim/model.cpp index be1e3e72f32..29c063dc0b4 100644 --- a/engines/grim/model.cpp +++ b/engines/grim/model.cpp @@ -57,7 +57,6 @@ Model::Model(const Common::String &filename, Common::SeekableReadStream *data, C TextSplitter ts(data); loadText(&ts, cmap); } - delete data; Math::Vector3d max; diff --git a/engines/grim/modelemi.cpp b/engines/grim/modelemi.cpp index 21ac445202a..ad1a1c91d2c 100644 --- a/engines/grim/modelemi.cpp +++ b/engines/grim/modelemi.cpp @@ -207,7 +207,6 @@ void EMIModel::draw() { EMIModel::EMIModel(const Common::String &filename, Common::SeekableReadStream *data, EMIModel *parent) : _fname(filename) { loadMesh(data); - delete data; } } // end of namespace Grim diff --git a/engines/grim/resource.cpp b/engines/grim/resource.cpp index d9f2c0ed454..566c10e9024 100644 --- a/engines/grim/resource.cpp +++ b/engines/grim/resource.cpp @@ -270,6 +270,7 @@ Common::SeekableReadStream *ResourceLoader::openNewStreamFile(Common::String fna byte *buf = new byte[size]; s->read(buf, size); putIntoCache(fname, buf, size); + delete s; s = new Common::MemoryReadStream(buf, size); } } else { @@ -301,6 +302,7 @@ Bitmap *ResourceLoader::loadBitmap(const Common::String &filename) { } Bitmap *result = new Bitmap(filename, stream); + delete stream; return result; } @@ -313,6 +315,7 @@ CMap *ResourceLoader::loadColormap(const Common::String &filename) { CMap *result = new CMap(filename, stream); _colormaps.push_back(result); + delete stream; return result; } @@ -343,6 +346,7 @@ Costume *ResourceLoader::loadCostume(const Common::String &filename, Costume *pr } Costume *result = new Costume(filename, stream, prevCost); + delete stream; return result; } @@ -355,6 +359,7 @@ Font *ResourceLoader::loadFont(const Common::String &filename) { error("Could not find font file %s", filename.c_str()); Font *result = new Font(filename, stream); + delete stream; return result; } @@ -368,6 +373,7 @@ KeyframeAnim *ResourceLoader::loadKeyframe(const Common::String &filename) { KeyframeAnim *result = new KeyframeAnim(filename, stream); _keyframeAnims.push_back(result); + delete stream; return result; } @@ -389,6 +395,7 @@ LipSync *ResourceLoader::loadLipSync(const Common::String &filename) { delete result; result = NULL; } + delete stream; return result; } @@ -403,6 +410,7 @@ Material *ResourceLoader::loadMaterial(const Common::String &filename, CMap *c) error("Could not find material %s", filename.c_str()); Material *result = new Material(fname, stream, c); + delete stream; return result; } @@ -417,6 +425,7 @@ Model *ResourceLoader::loadModel(const Common::String &filename, CMap *c, Model Model *result = new Model(filename, stream, c, parent); _models.push_back(result); + delete stream; return result; } @@ -433,6 +442,7 @@ EMIModel *ResourceLoader::loadModelEMI(const Common::String &filename, EMIModel EMIModel *result = new EMIModel(filename, stream, parent); _emiModels.push_back(result); + delete stream; return result; } @@ -448,6 +458,7 @@ Skeleton *ResourceLoader::loadSkeleton(const Common::String &filename) { } Skeleton *result = new Skeleton(filename, stream); + delete stream; return result; } diff --git a/engines/grim/set.cpp b/engines/grim/set.cpp index fb25f421080..7be11fdcee4 100644 --- a/engines/grim/set.cpp +++ b/engines/grim/set.cpp @@ -51,7 +51,6 @@ Set::Set(const Common::String &sceneName, Common::SeekableReadStream *data) : } else { loadBinary(data); } - delete data; } Set::Set() :