diff options
author | Paul Gilbert | 2017-09-24 12:02:48 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-09-24 12:02:48 -0400 |
commit | 5424f70002c8483448225aeb5982b709c2774e46 (patch) | |
tree | f091b504c0e6a7e68d0bc5979cd104ef75d55c77 /image/codecs | |
parent | 36ce79edb44cdc2eed121f795bd612b262fe1846 (diff) | |
download | scummvm-rg350-5424f70002c8483448225aeb5982b709c2774e46.tar.gz scummvm-rg350-5424f70002c8483448225aeb5982b709c2774e46.tar.bz2 scummvm-rg350-5424f70002c8483448225aeb5982b709c2774e46.zip |
IMAGE: Fix memory leak in BitmapRawDecoder
Diffstat (limited to 'image/codecs')
-rw-r--r-- | image/codecs/bmp_raw.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/image/codecs/bmp_raw.cpp b/image/codecs/bmp_raw.cpp index 68d70f25f6..1a856f1306 100644 --- a/image/codecs/bmp_raw.cpp +++ b/image/codecs/bmp_raw.cpp @@ -30,6 +30,8 @@ namespace Image { BitmapRawDecoder::BitmapRawDecoder(int width, int height, int bitsPerPixel) : Codec(), _surface(0), _width(width), _height(height), _bitsPerPixel(bitsPerPixel) { + _surface = new Graphics::Surface(); + _surface->create(_width, _height, getPixelFormat()); } BitmapRawDecoder::~BitmapRawDecoder() { @@ -42,9 +44,6 @@ BitmapRawDecoder::~BitmapRawDecoder() { const Graphics::Surface *BitmapRawDecoder::decodeFrame(Common::SeekableReadStream &stream) { Graphics::PixelFormat format = getPixelFormat(); - _surface = new Graphics::Surface(); - _surface->create(_width, _height, format); - int srcPitch = _width * (_bitsPerPixel >> 3); int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0; |