aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2014-05-30 13:54:19 -0700
committerEugene Sandulenko2016-09-29 22:33:35 +0200
commit2a60ddfd750a720a99a040f0094afa67f9de8429 (patch)
tree52217143be71dfd80b58eb3b21a14457674263df /engines/bladerunner
parentd93ecabc7ae5a24dabc4e21a6fcb5ec37e74566d (diff)
downloadscummvm-rg350-2a60ddfd750a720a99a040f0094afa67f9de8429.tar.gz
scummvm-rg350-2a60ddfd750a720a99a040f0094afa67f9de8429.tar.bz2
scummvm-rg350-2a60ddfd750a720a99a040f0094afa67f9de8429.zip
BLADERUNNER: Fix memory leaks in Image
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/image.cpp5
-rw-r--r--engines/bladerunner/image.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp
index 42070bc84a..157e443384 100644
--- a/engines/bladerunner/image.cpp
+++ b/engines/bladerunner/image.cpp
@@ -34,6 +34,10 @@ Image::Image(BladeRunnerEngine *vm)
{
}
+Image::~Image() {
+ _surface.free();
+}
+
bool Image::open(const Common::String &name) {
Common::SeekableReadStream *stream = _vm->getResourceStream(name);
if (!stream) {
@@ -67,6 +71,7 @@ bool Image::open(const Common::String &name) {
_surface.init(width, height, 2*width, data, pixelFormat);
delete[] buf;
+ delete stream;
return true;
}
diff --git a/engines/bladerunner/image.h b/engines/bladerunner/image.h
index 3980ff4c3c..75991d0f55 100644
--- a/engines/bladerunner/image.h
+++ b/engines/bladerunner/image.h
@@ -37,6 +37,7 @@ class Image {
Graphics::Surface _surface;
public:
Image(BladeRunnerEngine *vm);
+ ~Image();
bool open(const Common::String &name);
void copyToSurface(Graphics::Surface *surface) const;