IMAGE: Fix memory leak in BitmapRawDecoder
This commit is contained in:
parent
36ce79edb4
commit
5424f70002
1 changed files with 2 additions and 3 deletions
|
@ -30,6 +30,8 @@ namespace Image {
|
||||||
|
|
||||||
BitmapRawDecoder::BitmapRawDecoder(int width, int height, int bitsPerPixel) : Codec(),
|
BitmapRawDecoder::BitmapRawDecoder(int width, int height, int bitsPerPixel) : Codec(),
|
||||||
_surface(0), _width(width), _height(height), _bitsPerPixel(bitsPerPixel) {
|
_surface(0), _width(width), _height(height), _bitsPerPixel(bitsPerPixel) {
|
||||||
|
_surface = new Graphics::Surface();
|
||||||
|
_surface->create(_width, _height, getPixelFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapRawDecoder::~BitmapRawDecoder() {
|
BitmapRawDecoder::~BitmapRawDecoder() {
|
||||||
|
@ -42,9 +44,6 @@ BitmapRawDecoder::~BitmapRawDecoder() {
|
||||||
const Graphics::Surface *BitmapRawDecoder::decodeFrame(Common::SeekableReadStream &stream) {
|
const Graphics::Surface *BitmapRawDecoder::decodeFrame(Common::SeekableReadStream &stream) {
|
||||||
Graphics::PixelFormat format = getPixelFormat();
|
Graphics::PixelFormat format = getPixelFormat();
|
||||||
|
|
||||||
_surface = new Graphics::Surface();
|
|
||||||
_surface->create(_width, _height, format);
|
|
||||||
|
|
||||||
int srcPitch = _width * (_bitsPerPixel >> 3);
|
int srcPitch = _width * (_bitsPerPixel >> 3);
|
||||||
int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
|
int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue