From 5424f70002c8483448225aeb5982b709c2774e46 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Sep 2017 12:02:48 -0400 Subject: IMAGE: Fix memory leak in BitmapRawDecoder --- image/codecs/bmp_raw.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'image/codecs') 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; -- cgit v1.2.3