diff options
author | Nipun Garg | 2019-07-18 00:31:26 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:22 +0200 |
commit | 7709b2828b0148ed6662da891c493d73d95c25de (patch) | |
tree | 99243bd514db17fe008d39705a2ced84222a8287 | |
parent | b90f0e143fb9ea0ee25b399d50e0de0e504eb54c (diff) | |
download | scummvm-rg350-7709b2828b0148ed6662da891c493d73d95c25de.tar.gz scummvm-rg350-7709b2828b0148ed6662da891c493d73d95c25de.tar.bz2 scummvm-rg350-7709b2828b0148ed6662da891c493d73d95c25de.zip |
HDB: Fix memory leaks with FileMan::findFiles()
-rw-r--r-- | engines/hdb/ai-funcs.cpp | 2 | ||||
-rw-r--r-- | engines/hdb/gfx.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp index 25fd043d5b..5c8f929fd2 100644 --- a/engines/hdb/ai-funcs.cpp +++ b/engines/hdb/ai-funcs.cpp @@ -409,6 +409,8 @@ bool AI::cacheEntGfx(AIEntity *e, bool init) { } } j++; + + delete gfxFiles; } e->aiInit = aiEntList[i].initFunc; diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index b493bb625a..de897074e0 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -76,24 +76,25 @@ bool Gfx::init() { // Setup Tile Lookup Array _tLookupArray = new TileLookup[_numTiles]; - Common::Array<const char *> tileData = *g_hdb->_fileMan->findFiles("t32_", TYPE_TILE32); + Common::Array<const char *> *tileData = g_hdb->_fileMan->findFiles("t32_", TYPE_TILE32); - assert((uint)_numTiles == tileData.size()); + assert((uint)_numTiles == tileData->size()); int index = 0, skyIndex = 0; for (; index < _numTiles; index++) { - _tLookupArray[index].filename = tileData[index]; + _tLookupArray[index].filename = tileData->operator[](index); _tLookupArray[index].tData = NULL; _tLookupArray[index].skyIndex = 0; _tLookupArray[index].animIndex = index; // Check if the loaded Tile is a Sky Tile - if (strstr(tileData[index], "sky") && (skyIndex < kMaxSkies)) { + if (strstr(tileData->operator[](index), "sky") && (skyIndex < kMaxSkies)) { _tLookupArray[index].skyIndex = skyIndex + 1; _skyTiles[skyIndex] = index; skyIndex++; } } + delete tileData; // Add Animating Tile Info int found = -1; |