From f930abe56825080fc0dd4f5ae8b82f993c7ff715 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Thu, 24 Jul 2003 12:05:06 +0000 Subject: Check before releasing memory svn-id: r9163 --- simon/sound.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'simon/sound.cpp') 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); } } -- cgit v1.2.3