WINTERMUTE: Fix a leak in sound-file loading.

This commit is contained in:
Einar Johan Trøan Sømåen 2013-01-24 17:49:24 +01:00
parent 58777682fe
commit 199425562e

View File

@ -111,7 +111,7 @@ bool BaseSoundBuffer::loadFromFile(const Common::String &filename, bool forceRel
if (Audio::loadWAVFromStream(*_file, waveSize, waveRate, waveFlags, &waveType)) {
if (waveType == 1) {
// We need to wrap the file in a substream to make sure the size is right.
_file = new Common::SeekableSubReadStream(_file, _file->pos(), waveSize + _file->pos());
_file = new Common::SeekableSubReadStream(_file, _file->pos(), waveSize + _file->pos(), DisposeAfterUse::YES);
_stream = Audio::makeRawStream(_file, waveRate, waveFlags, DisposeAfterUse::YES);
} else {
error("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename.c_str(), waveType);