Skip to content

Commit

Permalink
DIRECTOR: Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent c7657b9 commit 51843bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions engines/director/score.cpp
Expand Up @@ -95,6 +95,14 @@ Score::Score(Archive &movie, Lingo &lingo) {

}

Score::~Score() {
_surface->free();
delete _surface;

_movieArchive->close();
delete _movieArchive;
}

void Score::loadFrames(Common::SeekableReadStream &stream) {
uint32 size = stream.readUint32BE();
size -= 4;
Expand Down Expand Up @@ -538,6 +546,10 @@ Frame::~Frame() {
for (uint16 i = 0; i < _sprites.size(); i++) {
delete _sprites[i];
}

for (uint16 i = 0; i < _drawRects.size(); i++) {
delete _drawRects[i];
}
}

void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
Expand Down
1 change: 1 addition & 0 deletions engines/director/score.h
Expand Up @@ -265,6 +265,7 @@ class Frame {
class Score {
public:
Score(Archive &movie, Lingo &lingo);
~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
void startLoop();

Expand Down

0 comments on commit 51843bc

Please sign in to comment.