diff options
author | Paweł Kołodziejski | 2008-01-19 11:14:28 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2008-01-19 11:14:28 +0000 |
commit | 2671e5083c8f54ff12a8845524e2a37b758b1f2e (patch) | |
tree | db54fb95a0c4447fe3725552d17bad23f66ce4ed /engines/scumm | |
parent | f0e131c9c3f15add381047e6f85f486d88c6d0d1 (diff) | |
download | scummvm-rg350-2671e5083c8f54ff12a8845524e2a37b758b1f2e.tar.gz scummvm-rg350-2671e5083c8f54ff12a8845524e2a37b758b1f2e.tar.bz2 scummvm-rg350-2671e5083c8f54ff12a8845524e2a37b758b1f2e.zip |
malloc -> new, free -> delete, added few asserts
svn-id: r30561
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 4f91f8e01d..aab53fc449 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -139,7 +139,7 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, } for (l = 0; l < sound->numSyncs; l++) { sound->sync[l].size = file->readUint32BE(); - sound->sync[l].ptr = (byte *)malloc(sound->sync[l].size); + sound->sync[l].ptr = new byte[sound->sync[l].size]; file->read(sound->sync[l].ptr, sound->sync[l].size); } if (version >= 3) { @@ -261,6 +261,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { sound->marker[curIndexMarker].pos = READ_BE_UINT32(ptr + 4); sound->marker[curIndexMarker].length = strlen((const char *)(ptr + 8)) + 1; sound->marker[curIndexMarker].ptr = new char[sound->marker[curIndexMarker].length]; + assert(sound->marker[curIndexMarker].ptr); strcpy(sound->marker[curIndexMarker].ptr, (const char *)(ptr + 8)); curIndexMarker++; } @@ -286,7 +287,8 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { case MKID_BE('SYNC'): size = READ_BE_UINT32(ptr); ptr += 4; sound->sync[curIndexSync].size = size; - sound->sync[curIndexSync].ptr = (byte *)malloc(size); + sound->sync[curIndexSync].ptr = new byte[size]; + assert(sound->sync[curIndexSync].ptr); memcpy(sound->sync[curIndexSync].ptr, ptr, size); curIndexSync++; ptr += size; @@ -484,7 +486,7 @@ void ImuseDigiSndMgr::closeSound(SoundDesc *soundDesc) { delete soundDesc->bundle; for (int r = 0; r < soundDesc->numSyncs; r++) - free(soundDesc->sync[r].ptr); + delete[] soundDesc->sync[r].ptr; for (int r = 0; r < soundDesc->numMarkers; r++) delete[] soundDesc->marker[r].ptr; delete[] soundDesc->region; |