From 7e0744aa4aa1e7128a1ea95d74db040ceb22a3a0 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Sun, 2 Jan 2011 14:57:49 +0000 Subject: VIDEO: Stop leaking surface data in several codecs. svn-id: r55095 --- graphics/video/codecs/cdtoons.cpp | 1 + graphics/video/codecs/indeo3.cpp | 1 + graphics/video/codecs/qtrle.cpp | 1 + graphics/video/codecs/rpza.cpp | 5 +++++ graphics/video/codecs/rpza.h | 2 +- graphics/video/codecs/smc.cpp | 5 +++++ graphics/video/codecs/smc.h | 2 +- 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/graphics/video/codecs/cdtoons.cpp b/graphics/video/codecs/cdtoons.cpp index 8cd38b1744..c3d00d8702 100644 --- a/graphics/video/codecs/cdtoons.cpp +++ b/graphics/video/codecs/cdtoons.cpp @@ -62,6 +62,7 @@ CDToonsDecoder::CDToonsDecoder(uint16 width, uint16 height) { } CDToonsDecoder::~CDToonsDecoder() { + _surface->free(); delete _surface; for (Common::HashMap::iterator i = _blocks.begin(); i != _blocks.end(); i++) diff --git a/graphics/video/codecs/indeo3.cpp b/graphics/video/codecs/indeo3.cpp index 51e946a75b..a19764dc11 100644 --- a/graphics/video/codecs/indeo3.cpp +++ b/graphics/video/codecs/indeo3.cpp @@ -58,6 +58,7 @@ Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height) : _ModPred(0), _correc } Indeo3Decoder::~Indeo3Decoder() { + _surface->free(); delete _surface; delete[] _iv_frame[0].the_buf; diff --git a/graphics/video/codecs/qtrle.cpp b/graphics/video/codecs/qtrle.cpp index e73d193896..380b89903c 100644 --- a/graphics/video/codecs/qtrle.cpp +++ b/graphics/video/codecs/qtrle.cpp @@ -415,6 +415,7 @@ const Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { QTRLEDecoder::~QTRLEDecoder() { _surface->free(); + delete _surface; } } // End of namespace Graphics diff --git a/graphics/video/codecs/rpza.cpp b/graphics/video/codecs/rpza.cpp index 7212aba64c..6869eaca7d 100644 --- a/graphics/video/codecs/rpza.cpp +++ b/graphics/video/codecs/rpza.cpp @@ -47,6 +47,11 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() { _surface->create(width, height, _pixelFormat.bytesPerPixel); } +RPZADecoder::~RPZADecoder() { + _surface->free(); + delete _surface; +} + #define ADVANCE_BLOCK() \ pixelPtr += 4; \ if (pixelPtr >= _surface->w) { \ diff --git a/graphics/video/codecs/rpza.h b/graphics/video/codecs/rpza.h index 7a5f2033eb..8be9088bc3 100644 --- a/graphics/video/codecs/rpza.h +++ b/graphics/video/codecs/rpza.h @@ -34,7 +34,7 @@ namespace Graphics { class RPZADecoder : public Codec { public: RPZADecoder(uint16 width, uint16 height); - ~RPZADecoder() { delete _surface; } + ~RPZADecoder(); const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return _pixelFormat; } diff --git a/graphics/video/codecs/smc.cpp b/graphics/video/codecs/smc.cpp index 2f75f5f21e..1b92d3bf85 100644 --- a/graphics/video/codecs/smc.cpp +++ b/graphics/video/codecs/smc.cpp @@ -52,6 +52,11 @@ SMCDecoder::SMCDecoder(uint16 width, uint16 height) { _surface->create(width, height, 1); } +SMCDecoder::~SMCDecoder() { + _surface->free(); + delete _surface; +} + const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { byte *pixels = (byte *)_surface->pixels; diff --git a/graphics/video/codecs/smc.h b/graphics/video/codecs/smc.h index c2ade00141..158cffbce8 100644 --- a/graphics/video/codecs/smc.h +++ b/graphics/video/codecs/smc.h @@ -40,7 +40,7 @@ enum { class SMCDecoder : public Codec { public: SMCDecoder(uint16 width, uint16 height); - ~SMCDecoder() { delete _surface; } + ~SMCDecoder(); const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } -- cgit v1.2.3