aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2003-07-24 12:05:06 +0000
committerTravis Howell2003-07-24 12:05:06 +0000
commitf930abe56825080fc0dd4f5ae8b82f993c7ff715 (patch)
tree8fa2098912fb24baaee8855510e97569ebefb58f
parentda0db02f6e4fb2fdd626962440987540d1e27153 (diff)
downloadscummvm-rg350-f930abe56825080fc0dd4f5ae8b82f993c7ff715.tar.gz
scummvm-rg350-f930abe56825080fc0dd4f5ae8b82f993c7ff715.tar.bz2
scummvm-rg350-f930abe56825080fc0dd4f5ae8b82f993c7ff715.zip
Check before releasing memory
svn-id: r9163
-rw-r--r--simon/sound.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/simon/sound.cpp b/simon/sound.cpp
index c7519e7ead..81d2c9c0a8 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -422,6 +422,9 @@ void SimonSound::readVoiceFile(const char *filename, const char *gameDataPath) {
}
}
+ if (_voice)
+ delete _voice;
+
_voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
}
@@ -434,6 +437,9 @@ void SimonSound::playVoice(uint sound) {
if (file->isOpen() == false) {
warning("Can't open voice file %s", filename);
} else {
+ if (_voice)
+ delete _voice;
+
_voice = new WavSound(_mixer, file, _offsets);
}
}