aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorMax Horn2003-06-21 15:36:19 +0000
committerMax Horn2003-06-21 15:36:19 +0000
commit3de24123e737a0bc4584b3a59db553d74a2dfdf0 (patch)
treeacab8ca23d2167bd18d69ae16baa6a969e814cda /simon
parent0cb2053d9d4a2e9f44edc36e4a87a34962dd3606 (diff)
downloadscummvm-rg350-3de24123e737a0bc4584b3a59db553d74a2dfdf0.tar.gz
scummvm-rg350-3de24123e737a0bc4584b3a59db553d74a2dfdf0.tar.bz2
scummvm-rg350-3de24123e737a0bc4584b3a59db553d74a2dfdf0.zip
fix some memory leaks
svn-id: r8580
Diffstat (limited to 'simon')
-rw-r--r--simon/sound.cpp15
-rw-r--r--simon/sound.h3
2 files changed, 16 insertions, 2 deletions
diff --git a/simon/sound.cpp b/simon/sound.cpp
index d38cd3903f..d04a919dc4 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -31,7 +31,7 @@ protected:
public:
BaseSound(SoundMixer *mixer, File *file, uint32 base = 0);
BaseSound(SoundMixer *mixer, File *file, uint32 *offsets);
- virtual ~BaseSound() { delete _file; }
+ virtual ~BaseSound();
virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0) = 0;
};
@@ -91,6 +91,11 @@ BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 *offsets) {
_offsets = offsets;
}
+BaseSound::~BaseSound() {
+ free(_offsets);
+ delete _file;
+}
+
#if !defined(__GNUC__)
#pragma START_PACK_STRUCTS
#endif
@@ -322,6 +327,14 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
}
}
+SimonSound::~SimonSound() {
+ delete _voice;
+ delete _effects;
+
+ free(_filenums);
+ free(_offsets);
+}
+
void SimonSound::readSfxFile(const char *filename, const char *gameDataPath) {
stopAll();
diff --git a/simon/sound.h b/simon/sound.h
index 8a510a4e66..d3eb7ab325 100644
--- a/simon/sound.h
+++ b/simon/sound.h
@@ -50,7 +50,8 @@ public:
uint _ambient_playing;
SimonSound(const byte game, const GameSpecificSettings *gss, const char *gameDataPath, SoundMixer *mixer);
-
+ ~SimonSound();
+
void readSfxFile(const char *filename, const char *gameDataPath);
void loadSfxTable(File *gameFile, uint32 base);