aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-10-15 09:21:13 +0000
committerNicola Mettifogo2007-10-15 09:21:13 +0000
commit913ef56024bd67e81e06129603314cfc40954f05 (patch)
treebe6615ca3eec74a4314e152ef4c18c4431fee49f
parentf9b8c8a0d42b03662c9cb7dcada89af1d832239b (diff)
downloadscummvm-rg350-913ef56024bd67e81e06129603314cfc40954f05.tar.gz
scummvm-rg350-913ef56024bd67e81e06129603314cfc40954f05.tar.bz2
scummvm-rg350-913ef56024bd67e81e06129603314cfc40954f05.zip
Now correctly disposing of audio data only when it was allocated on the heap, thus fixing bug #1813367.
svn-id: r29223
-rw-r--r--engines/parallaction/sound.cpp4
-rw-r--r--engines/parallaction/sound.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp
index 4d4386b642..872ed29b08 100644
--- a/engines/parallaction/sound.cpp
+++ b/engines/parallaction/sound.cpp
@@ -331,12 +331,14 @@ void AmigaSoundMan::loadChannelData(const char *filename, Channel *ch) {
ch->header.volume = 255;
ch->data = res_amigaBeep;
ch->dataSize = 16;
+ ch->dispose = false;
return;
}
Common::ReadStream *stream = _vm->_disk->loadSound(filename);
Audio::A8SVXDecoder decoder(*stream, ch->header, ch->data, ch->dataSize);
decoder.decode();
+ ch->dispose = true;
delete stream;
}
@@ -381,7 +383,7 @@ void AmigaSoundMan::stopSfx(uint channel) {
return;
}
- if (_channels[channel].data) {
+ if (_channels[channel].dispose) {
debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel);
_mixer->stopHandle(_channels[channel].handle);
free(_channels[channel].data);
diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h
index 051cb25995..c07fa9affc 100644
--- a/engines/parallaction/sound.h
+++ b/engines/parallaction/sound.h
@@ -91,6 +91,7 @@ class AmigaSoundMan : public SoundMan {
Audio::Voice8Header header;
byte *data;
uint32 dataSize;
+ bool dispose;
Audio::SoundHandle handle;
uint32 flags;
} _channels[NUM_AMIGA_CHANNELS];