aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-14 04:24:32 +0100
committerJohannes Schickel2015-12-14 05:08:05 +0100
commit184ae49302792a924856ae051f1a96078f0723a1 (patch)
treed0b0c1ace16e7b68d0cd4867937cdbbeb4d6dc8d /engines/sword25
parent74321fcd22e6bb6598abfefc9a52de87a422ee7a (diff)
downloadscummvm-rg350-184ae49302792a924856ae051f1a96078f0723a1.tar.gz
scummvm-rg350-184ae49302792a924856ae051f1a96078f0723a1.tar.bz2
scummvm-rg350-184ae49302792a924856ae051f1a96078f0723a1.zip
SWORD25: Plug memory leak in RenderedImage.
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp3
-rw-r--r--engines/sword25/gfx/image/renderedimage.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 0225787fde..8d90d1fa8b 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -178,6 +178,9 @@ RenderedImage::RenderedImage() : _isTransparent(true) {
// -----------------------------------------------------------------------------
RenderedImage::~RenderedImage() {
+ if (_doCleanup) {
+ _surface.free();
+ }
}
// -----------------------------------------------------------------------------
diff --git a/engines/sword25/gfx/image/renderedimage.h b/engines/sword25/gfx/image/renderedimage.h
index 5b65a27355..e4d573f369 100644
--- a/engines/sword25/gfx/image/renderedimage.h
+++ b/engines/sword25/gfx/image/renderedimage.h
@@ -44,6 +44,9 @@
namespace Sword25 {
class RenderedImage : public Image {
+private:
+ RenderedImage(const RenderedImage &) : _doCleanup(false) {}
+ RenderedImage &operator=(const RenderedImage &) { return *this; }
public:
RenderedImage(const Common::String &filename, bool &result);