[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.90,1.91
Max Horn
fingolfin at users.sourceforge.net
Thu Mar 6 17:36:13 CET 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv14261
Modified Files:
sound.cpp
Log Message:
uhh - code did modify ptr, then free() it (even before my change, which exposed the problem by always freeing, not just upon errors
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- sound.cpp 7 Mar 2003 01:21:55 -0000 1.90
+++ sound.cpp 7 Mar 2003 01:35:54 -0000 1.91
@@ -1160,7 +1160,7 @@
}
int Sound::playBundleSound(char *sound) {
- byte *ptr;
+ byte *ptr, *orig_ptr;
bool result;
if (_scumm->_noDigitalSamples)
@@ -1197,23 +1197,24 @@
ptr = (byte *)malloc(1000000);
output_size = _scumm->_bundle->decompressVoiceSampleByName(name, ptr);
if (output_size == 0) {
- delete ptr;
+ free(ptr);
return -1;
}
} else {
ptr = (byte *)malloc(1000000);
output_size = _scumm->_bundle->decompressVoiceSampleByName(sound, ptr);
if (output_size == 0) {
- delete ptr;
+ free(ptr);
return -1;
}
}
assert(output_size <= 1000000);
+ orig_ptr = ptr;
tag = READ_BE_UINT32(ptr); ptr += 4;
if (tag != MKID_BE('iMUS')) {
warning("Decompression of bundle sound failed");
- free(ptr);
+ free(orig_ptr);
return -1;
}
@@ -1252,7 +1253,7 @@
byte *final = (byte *)malloc(size);
memcpy(final, ptr, size);
- free(ptr);
+ free(orig_ptr);
if (_scumm->_actorToPrintStrFor != 0xFF && _scumm->_actorToPrintStrFor != 0) {
Actor *a = _scumm->derefActorSafe(_scumm->_actorToPrintStrFor, "playBundleSound");
More information about the Scummvm-git-logs
mailing list