From ccf88578c808cf7a4f53d3f284c9db7074064b67 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 31 Aug 2008 10:43:32 +0000 Subject: Fixed leak with Input class, introduced in commit 34206. svn-id: r34224 --- engines/parallaction/graphics.h | 7 +++++-- engines/parallaction/input.cpp | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 497152c08c..ac9f096d7e 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -313,6 +313,7 @@ struct Cnv : public Frames { uint16 _height; // byte** field_8; // unused byte* _data; + bool _freeData; public: Cnv() { @@ -320,12 +321,14 @@ public: _data = NULL; } - Cnv(uint16 numFrames, uint16 width, uint16 height, byte* data) : _count(numFrames), _width(width), _height(height), _data(data) { + Cnv(uint16 numFrames, uint16 width, uint16 height, byte* data, bool freeData = false) + : _count(numFrames), _width(width), _height(height), _data(data), _freeData(freeData) { } ~Cnv() { - free(_data); + if (_freeData) + free(_data); } byte* getFramePtr(uint16 index) { diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index c14c512a26..98198b88f7 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -421,10 +421,12 @@ bool Input::isMouseEnabled() { void Input::initCursors() { + _dinoCursor = _donnaCursor = _dougCursor = 0; + switch (_gameType) { case GType_Nippon: _comboArrow = _vm->_disk->loadPointer("pointer"); - _mouseArrow = new Cnv(1, MOUSEARROW_WIDTH_NS, MOUSEARROW_HEIGHT_NS, _resMouseArrow_NS); + _mouseArrow = new Cnv(1, MOUSEARROW_WIDTH_NS, MOUSEARROW_HEIGHT_NS, _resMouseArrow_NS, false); break; case GType_BRA: -- cgit v1.2.3