diff options
-rw-r--r-- | engines/hdb/file-manager.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/gfx.cpp | 8 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/lua-script.cpp | 3 | ||||
-rw-r--r-- | engines/hdb/map.cpp | 1 |
5 files changed, 15 insertions, 1 deletions
diff --git a/engines/hdb/file-manager.cpp b/engines/hdb/file-manager.cpp index e28f19fa05..295999a787 100644 --- a/engines/hdb/file-manager.cpp +++ b/engines/hdb/file-manager.cpp @@ -128,7 +128,7 @@ Common::SeekableReadStream *FileMan::findFirstData(const char *string, DataType // Load corresponding file into a buffer _mpcFile->seek(file->offset); - byte *buffer = new byte[file->ulength]; + byte *buffer = (byte *)malloc(file->ulength * sizeof(byte)); _mpcFile->read(buffer, file->ulength); diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index de897074e0..bc6046dae1 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -386,6 +386,7 @@ Picture *Gfx::loadPic(const char *picName) { if (!stream) return NULL; pic->load(stream); + delete stream; return pic; } @@ -395,6 +396,7 @@ Tile *Gfx::loadTile(const char *tileName) { if (!stream) return NULL; tile->load(stream); + delete stream; return tile; } @@ -404,6 +406,7 @@ Tile *Gfx::loadIcon(const char *tileName) { if (!stream) return NULL; tile->load(stream); + delete stream; return tile; } @@ -424,6 +427,7 @@ Tile *Gfx::getTile(int index) { Common::SeekableReadStream *stream = g_hdb->_fileMan->findFirstData(_tLookupArray[index].filename, TYPE_TILE32); Tile *tile = new Tile; tile->load(stream); + delete stream; _tLookupArray[index].tData = tile; } @@ -455,6 +459,7 @@ Picture *Gfx::getPicture(const char *name) { Common::SeekableReadStream *stream = g_hdb->_fileMan->findFirstData(name, TYPE_PIC); Picture *picture = new Picture; picture->load(stream); + delete stream; return picture; } @@ -523,6 +528,7 @@ Tile *Gfx::getTileGfx(const char *name, int32 size) { Tile *gfxTile = new Tile; gfxTile->load(stream); + delete stream; gc->tileGfx = gfxTile; if (size == -1) @@ -562,6 +568,7 @@ Picture *Gfx::getPicGfx(const char *name, int32 size) { Picture *gfxPic = new Picture; gfxPic->load(stream); + delete stream; gc->picGfx = gfxPic; if (size == -1) @@ -753,6 +760,7 @@ bool Gfx::loadFont(const char *string) { // Loading _fontGfx _fontGfx = stream->readUint16LE(); + delete stream; return true; } diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 49a2f99807..f7c2c64e7f 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -833,6 +833,7 @@ Common::Error HDBGame::run() { Picture *titlePic = new Picture; titlePic->load(titleStream); + delete titleStream; Common::SeekableReadStream *tileStream = _fileMan->findFirstData("t32_ground1", TYPE_TILE32); if (tileStream == NULL) { @@ -842,6 +843,7 @@ Common::Error HDBGame::run() { Tile *tile = new Tile; tile->load(tileStream); + delete tileStream; #endif if (ConfMan.hasKey("boot_param")) { diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 1b62081cc6..54cd2c9846 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -66,6 +66,8 @@ LuaScript::~LuaScript() { if (_state) { lua_close(_state); } + if (_globalLuaStream) + delete _globalLuaStream; } bool LuaScript::init() { @@ -92,6 +94,7 @@ bool LuaScript::loadLua(const char *name) { } _systemInit = initScript(luaStream, name, luaLength); + delete luaStream; return true; } diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp index 66fc9ab570..450f182927 100644 --- a/engines/hdb/map.cpp +++ b/engines/hdb/map.cpp @@ -264,6 +264,7 @@ bool Map::loadMap(char *name) { } load(mapStream); + delete mapStream; return true; } |