[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.25,1.26 sound.h,1.9,1.10

Max Horn fingolfin at users.sourceforge.net
Sat Jun 21 08:37:11 CEST 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv23463

Modified Files:
	sound.cpp sound.h 
Log Message:
fix some memory leaks

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- sound.cpp	21 Jun 2003 15:32:25 -0000	1.25
+++ sound.cpp	21 Jun 2003 15:36:19 -0000	1.26
@@ -31,7 +31,7 @@
 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 @@
 	_offsets = offsets;
 }
 
+BaseSound::~BaseSound() {
+	free(_offsets);
+	delete _file;
+}
+
 #if !defined(__GNUC__)
 #pragma START_PACK_STRUCTS
 #endif
@@ -320,6 +325,14 @@
 		}
 #endif
 	}
+}
+
+SimonSound::~SimonSound() {
+	delete _voice;
+	delete _effects;
+	
+	free(_filenums);
+	free(_offsets);
 }
 
 void SimonSound::readSfxFile(const char *filename, const char *gameDataPath) {

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sound.h	15 Jun 2003 12:22:19 -0000	1.9
+++ sound.h	21 Jun 2003 15:36:19 -0000	1.10
@@ -50,7 +50,8 @@
 	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);
 





More information about the Scummvm-git-logs mailing list