mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
Merge pull request #494 from klusark/stream
GRIM: Fix some memory leaks related to not always freeing streams Fixes #480
This commit is contained in:
commit
315b0275c5
@ -124,7 +124,6 @@ BitmapData::BitmapData(const Common::String &fname, Common::SeekableReadStream *
|
||||
Debug::error(Debug::Bitmaps, "Invalid magic loading bitmap");
|
||||
break;
|
||||
}
|
||||
delete data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -77,7 +77,6 @@ LipSync::LipSync(const Common::String &filename, Common::SeekableReadStream *dat
|
||||
}
|
||||
}
|
||||
|
||||
delete data;
|
||||
}
|
||||
|
||||
LipSync::~LipSync() {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ Set::Set(const Common::String &sceneName, Common::SeekableReadStream *data) :
|
||||
} else {
|
||||
loadBinary(data);
|
||||
}
|
||||
delete data;
|
||||
}
|
||||
|
||||
Set::Set() :
|
||||
|
Loading…
x
Reference in New Issue
Block a user