aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2008-01-15 20:30:48 +0000
committerTorbjörn Andersson2008-01-15 20:30:48 +0000
commit5dc2caa3070d35bd41446089d34609ee1c50e546 (patch)
treecdc6d02b87162647a0a4091682471d11f59447a4 /engines
parentd0e5df5bfaa583692b9114fab0964135fa24d24c (diff)
downloadscummvm-rg350-5dc2caa3070d35bd41446089d34609ee1c50e546.tar.gz
scummvm-rg350-5dc2caa3070d35bd41446089d34609ee1c50e546.tar.bz2
scummvm-rg350-5dc2caa3070d35bd41446089d34609ee1c50e546.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/imuse_digi/dimuse.cpp2
-rw-r--r--engines/scumm/imuse_digi/dimuse_bndmgr.cpp2
-rw-r--r--engines/scumm/imuse_digi/dimuse_codecs.cpp2
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp
index 54908ee445..1874546259 100644
--- a/engines/scumm/imuse_digi/dimuse.cpp
+++ b/engines/scumm/imuse_digi/dimuse.cpp
@@ -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) {
diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp
index f0b4bc131b..a88faed3db 100644
--- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp
+++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp
@@ -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;
diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp
index 8ff8bd2461..e4bce827c4 100644
--- a/engines/scumm/imuse_digi/dimuse_codecs.cpp
+++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp
@@ -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;
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
index 2686696684..35eb421be6 100644
--- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -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;
}