aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/audio.cpp
diff options
context:
space:
mode:
authorDavid Turner2010-11-09 23:57:56 +0000
committerDavid Turner2010-11-09 23:57:56 +0000
commita74b8ad67f7c334051dce8bdb74a514169f905af (patch)
tree6912b40a2ccc8dd58e096171b6e44d72ff24014a /engines/toon/audio.cpp
parent95a58b24712ee0f3801485be1534ade0b733017e (diff)
downloadscummvm-rg350-a74b8ad67f7c334051dce8bdb74a514169f905af.tar.gz
scummvm-rg350-a74b8ad67f7c334051dce8bdb74a514169f905af.tar.bz2
scummvm-rg350-a74b8ad67f7c334051dce8bdb74a514169f905af.zip
TOON: More corrections to close memory leaks.
These corrections close a number of leaks in the Toon engine reported by running Valgrind with --leak-check=full option, but a significant number still remain. svn-id: r54176
Diffstat (limited to 'engines/toon/audio.cpp')
-rw-r--r--engines/toon/audio.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 386d00ef77..592d1a7388 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -208,10 +208,8 @@ void AudioManager::stopCurrentVoice() {
void AudioManager::closeAudioPack(int32 id) {
- if(_audioPacks[id]) {
- delete _audioPacks[id];
- _audioPacks[id] = 0;
- }
+ delete _audioPacks[id];
+ _audioPacks[id] = NULL;
}
bool AudioManager::loadAudioPack(int32 id, Common::String indexFile, Common::String packFile) {
@@ -239,10 +237,6 @@ void AudioManager::stopMusic() {
if (_channels[1])
_channels[1]->stop(true);
}
-AudioStreamInstance::~AudioStreamInstance() {
- if (_man)
- _man->removeInstance(this);
-}
AudioStreamInstance::AudioStreamInstance(AudioManager *man, Audio::Mixer *mixer, Common::SeekableReadStream *stream , bool looping) {
_compBufferSize = 0;
@@ -274,6 +268,11 @@ AudioStreamInstance::AudioStreamInstance(AudioManager *man, Audio::Mixer *mixer,
}
}
+AudioStreamInstance::~AudioStreamInstance() {
+ if (_man)
+ _man->removeInstance(this);
+}
+
int AudioStreamInstance::readBuffer(int16 *buffer, const int numSamples) {
debugC(5, kDebugAudio, "readBuffer(buffer, %d)", numSamples);