Skip to content

Commit

Permalink
BLADERUNNER: Fix memory leaks in Image
Browse files Browse the repository at this point in the history
  • Loading branch information
madmoose authored and sev- committed Sep 29, 2016
1 parent d93ecab commit 2a60ddf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions engines/bladerunner/image.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions engines/bladerunner/image.h
Expand Up @@ -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;
Expand Down

0 comments on commit 2a60ddf

Please sign in to comment.