diff options
author | Torbjörn Andersson | 2016-07-15 11:29:19 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2016-07-15 11:29:19 +0200 |
commit | 72269b6c9da89de835df5a7e3e083dfd7cd0b432 (patch) | |
tree | 0a994434213c5f8ce21f86ddd9f7f838a4dd9064 | |
parent | 9284204cf698dc75cd5efac84e6a0f2ba792e857 (diff) | |
download | scummvm-rg350-72269b6c9da89de835df5a7e3e083dfd7cd0b432.tar.gz scummvm-rg350-72269b6c9da89de835df5a7e3e083dfd7cd0b432.tar.bz2 scummvm-rg350-72269b6c9da89de835df5a7e3e083dfd7cd0b432.zip |
WAGE: Fix memory leak in drawBitmap()
The 'tmp' surface was never freed when in _boundsCalculationMode.
-rw-r--r-- | engines/wage/design.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index f2a8aba812..2bfea9df7d 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -474,28 +474,27 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS in.skip(numBytes); - if (_boundsCalculationMode) - return; - - Graphics::FloodFill ff(&tmp, kColorWhite, kColorGreen); - for (int yy = 0; yy < h; yy++) { - ff.addSeed(0, yy); - ff.addSeed(w - 1, yy); - } - for (int xx = 0; xx < w; xx++) { - ff.addSeed(xx, 0); - ff.addSeed(xx, h - 1); - } - ff.fill(); - - for (y = 0; y < h && y1 + y < surface->h; y++) { - byte *src = (byte *)tmp.getBasePtr(0, y); - byte *dst = (byte *)surface->getBasePtr(x1, y1 + y); - for (x = 0; x < w; x++) { - if (*src != kColorGreen) - *dst = *src; - src++; - dst++; + if (!_boundsCalculationMode) { + Graphics::FloodFill ff(&tmp, kColorWhite, kColorGreen); + for (int yy = 0; yy < h; yy++) { + ff.addSeed(0, yy); + ff.addSeed(w - 1, yy); + } + for (int xx = 0; xx < w; xx++) { + ff.addSeed(xx, 0); + ff.addSeed(xx, h - 1); + } + ff.fill(); + + for (y = 0; y < h && y1 + y < surface->h; y++) { + byte *src = (byte *)tmp.getBasePtr(0, y); + byte *dst = (byte *)surface->getBasePtr(x1, y1 + y); + for (x = 0; x < w; x++) { + if (*src != kColorGreen) + *dst = *src; + src++; + dst++; + } } } |