diff options
author | Colin Snover | 2016-03-06 16:40:23 -0600 |
---|---|---|
committer | Colin Snover | 2016-03-06 21:34:43 -0600 |
commit | 36800b701764222ec0c527f68504d1d3dc2e1fcc (patch) | |
tree | bc2cd25a328a3301e0207ce380487f276068f7df /engines/sci/graphics/celobj32.cpp | |
parent | 3e631ca5e3a3e19cb08be83c039ae9681a2e6cbc (diff) | |
download | scummvm-rg350-36800b701764222ec0c527f68504d1d3dc2e1fcc.tar.gz scummvm-rg350-36800b701764222ec0c527f68504d1d3dc2e1fcc.tar.bz2 scummvm-rg350-36800b701764222ec0c527f68504d1d3dc2e1fcc.zip |
SCI32: Fix memory leaks
Diffstat (limited to 'engines/sci/graphics/celobj32.cpp')
-rw-r--r-- | engines/sci/graphics/celobj32.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp index 787d295d5e..b839b44e92 100644 --- a/engines/sci/graphics/celobj32.cpp +++ b/engines/sci/graphics/celobj32.cpp @@ -84,10 +84,9 @@ const CelScalerTable *CelScaler::getScalerTable(const Ratio &scaleX, const Ratio #pragma mark CelObj void CelObj::init() { + CelObj::deinit(); _nextCacheId = 1; - delete _scaler; _scaler = new CelScaler(); - delete _cache; _cache = new CelCache; _cache->resize(100); } @@ -95,6 +94,11 @@ void CelObj::init() { void CelObj::deinit() { delete _scaler; _scaler = nullptr; + if (_cache != nullptr) { + for (CelCache::iterator it = _cache->begin(); it != _cache->end(); ++it) { + delete it->celObj; + } + } delete _cache; _cache = nullptr; } |