diff options
author | Paul Gilbert | 2018-11-17 10:38:51 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 813918aaba8c2f86d55c4b256da7ee79c155b12f (patch) | |
tree | 4fdfd31ad74e1d99dd96d6dc65f05295cbaf4a49 /engines/glk/streams.cpp | |
parent | 4b011b2f1cfdc3aac0468248f4feb9faea3501a2 (diff) | |
download | scummvm-rg350-813918aaba8c2f86d55c4b256da7ee79c155b12f.tar.gz scummvm-rg350-813918aaba8c2f86d55c4b256da7ee79c155b12f.tar.bz2 scummvm-rg350-813918aaba8c2f86d55c4b256da7ee79c155b12f.zip |
GLK: Memory leak fixes
Diffstat (limited to 'engines/glk/streams.cpp')
-rw-r--r-- | engines/glk/streams.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp index 801cd549a8..cd7130fb35 100644 --- a/engines/glk/streams.cpp +++ b/engines/glk/streams.cpp @@ -75,6 +75,10 @@ void Stream::setReverseVideo(bool reverse) { /*--------------------------------------------------------------------------*/ +WindowStream::~WindowStream() { + _window->_stream = nullptr; +} + void WindowStream::close(StreamResult *result) { warning("cannot close window stream"); } @@ -1407,8 +1411,10 @@ Streams::Streams() : _streamList(nullptr), _currentStream(nullptr) { } Streams::~Streams() { - while (_streamList) - delete _streamList; + for (Stream *currStream = _streamList, *nextStream; currStream; currStream = nextStream) { + nextStream = currStream->_next; + delete currStream; + } } FileStream *Streams::openFileStream(frefid_t fref, glui32 fmode, glui32 rock, bool unicode) { |