diff options
author | uruk | 2014-07-07 21:52:16 +0200 |
---|---|---|
committer | uruk | 2014-07-07 21:52:16 +0200 |
commit | 1335247f8235c4abd3062ff0989ea2a3cd5b608b (patch) | |
tree | 7566c42206116682df9b9665b2d04a3382340651 /engines/cge2 | |
parent | c7aa91019b08c52976356031cf2059333ab6fd23 (diff) | |
download | scummvm-rg350-1335247f8235c4abd3062ff0989ea2a3cd5b608b.tar.gz scummvm-rg350-1335247f8235c4abd3062ff0989ea2a3cd5b608b.tar.bz2 scummvm-rg350-1335247f8235c4abd3062ff0989ea2a3cd5b608b.zip |
CGE2: Hopefully fix memory leak problems regarding _ext.
Diffstat (limited to 'engines/cge2')
-rw-r--r-- | engines/cge2/hero.cpp | 3 | ||||
-rw-r--r-- | engines/cge2/vga13h.cpp | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp index 4b50cccd8b..85eb09bede 100644 --- a/engines/cge2/hero.cpp +++ b/engines/cge2/hero.cpp @@ -46,6 +46,9 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo char fname[kMaxPath]; _vm->mergeExt(fname, _file, kSprExt); + + if (_ext != nullptr) + delete _ext; _ext = new SprExt(_vm); if (_ext == nullptr) error("No core %s", fname); diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 340f9c0966..d7e0552253 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -261,8 +261,14 @@ Sprite *Sprite::expand() { if (_vm->_spriteNotify != nullptr) (_vm->*_vm->_spriteNotify)(); + char fname[kPathMax]; + _vm->mergeExt(fname, _file, kSprExt); + + if (_ext != nullptr) + delete _ext; _ext = new SprExt(_vm); - assert(_ext != nullptr); + if (_ext == nullptr) + error("No core %s", fname); if (!*_file) return this; @@ -275,9 +281,6 @@ Sprite *Sprite::expand() { maxnow = 0, maxnxt = 0; - char fname[kPathMax]; - _vm->mergeExt(fname, _file, kSprExt); - Seq *curSeq; if (_seqCnt) { curSeq = new Seq[_seqCnt]; @@ -479,6 +482,7 @@ Sprite *Sprite::contract() { } } + delete _ext; _ext = nullptr; return this; |