[Scummvm-cvs-logs] CVS: scummvm/scumm player_mod.cpp,2.12,2.13 player_mod.h,2.10,2.11
Max Horn
fingolfin at users.sourceforge.net
Sat Dec 27 16:31:01 CET 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv18553
Modified Files:
player_mod.cpp player_mod.h
Log Message:
don't do double-free
Index: player_mod.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_mod.cpp,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -d -r2.12 -r2.13
--- player_mod.cpp 24 Dec 2003 00:24:57 -0000 2.12
+++ player_mod.cpp 28 Dec 2003 00:19:56 -0000 2.13
@@ -39,7 +39,6 @@
_channels[i].id = 0;
_channels[i].vol = 0;
_channels[i].freq = 0;
- _channels[i].ptr = NULL;
_channels[i].converter = NULL;
_channels[i].input = NULL;
}
@@ -56,13 +55,12 @@
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (!_channels[i].id)
continue;
- free(_channels[i].ptr);
delete _channels[i].converter;
delete _channels[i].input;
}
}
-void Player_MOD::setMasterVolume (int vol) {
+void Player_MOD::setMasterVolume(int vol) {
_maxvol = vol;
}
@@ -77,7 +75,7 @@
_mixamt = 0;
}
-void Player_MOD::startChannel (int id, void *data, int size, int rate, uint8 vol, int loopStart, int loopEnd, int8 pan) {
+void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol, int loopStart, int loopEnd, int8 pan) {
int i;
if (id == 0)
error("player_mod - attempted to start channel id 0");
@@ -93,7 +91,6 @@
_channels[i].id = id;
_channels[i].vol = vol;
_channels[i].pan = pan;
- _channels[i].ptr = data;
_channels[i].freq = rate;
_channels[i].input = makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | (loopStart != loopEnd ? SoundMixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart);
_channels[i].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false);
@@ -104,8 +101,6 @@
error("player_mod - attempted to stop channel id 0");
for (int i = 0; i < MOD_MAXCHANS; i++) {
if (_channels[i].id == id) {
- free(_channels[i].ptr);
- _channels[i].ptr = NULL;
delete _channels[i].converter;
_channels[i].converter = NULL;
delete _channels[i].input;
Index: player_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/player_mod.h,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -d -r2.10 -r2.11
--- player_mod.h 24 Dec 2003 00:24:57 -0000 2.10
+++ player_mod.h 28 Dec 2003 00:19:56 -0000 2.11
@@ -60,7 +60,6 @@
uint8 vol;
int8 pan;
uint16 freq;
- void *ptr;
RateConverter *converter;
AudioInputStream *input;
};
More information about the Scummvm-git-logs
mailing list