mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
Since the mixer uses 'delete' to free memory, we should allocate it with 'new'.
I don't know if I got all cases, but I no longer get any Valgrind warnings at the beginning of CoMI when using the original sound/music files. svn-id: r30501
This commit is contained in:
parent
d0e5df5bfa
commit
5dc2caa307
@ -302,7 +302,7 @@ void IMuseDigital::callback() {
|
||||
int tmpFeedSize = _sound->getDataFromRegion(track->soundDesc, track->curRegion, &tmpPtr, tmpOffset, tmpFeedSize12Bits);
|
||||
curFeedSize = BundleCodecs::decode12BitsSample(tmpPtr, &tmpSndBufferPtr, tmpFeedSize);
|
||||
|
||||
free(tmpPtr);
|
||||
delete[] tmpPtr;
|
||||
} else if (bits == 16) {
|
||||
curFeedSize = _sound->getDataFromRegion(track->soundDesc, track->curRegion, &tmpSndBufferPtr, track->regionOffset, feedSize);
|
||||
if (channels == 1) {
|
||||
|
@ -281,7 +281,7 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size,
|
||||
lastBlock = _numCompItems - 1;
|
||||
|
||||
int32 blocksFinalSize = 0x2000 * (1 + lastBlock - firstBlock);
|
||||
*compFinal = (byte *)malloc(blocksFinalSize);
|
||||
*compFinal = new byte[blocksFinalSize];
|
||||
assert(*compFinal);
|
||||
finalSize = 0;
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace BundleCodecs {
|
||||
uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size) {
|
||||
uint32 loop_size = size / 3;
|
||||
uint32 s_size = loop_size * 4;
|
||||
byte *ptr = *dst = (byte *)malloc(s_size);
|
||||
byte *ptr = *dst = new byte[s_size];
|
||||
assert(ptr);
|
||||
|
||||
uint32 tmp;
|
||||
|
@ -461,7 +461,7 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char
|
||||
sound->disk = _disk;
|
||||
prepareSound(ptr, sound);
|
||||
if ((soundType == IMUSE_BUNDLE) && !sound->compressed) {
|
||||
free(ptr);
|
||||
delete[] ptr;
|
||||
}
|
||||
return sound;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user