aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-04-24 15:33:36 +0000
committerPaweł Kołodziejski2004-04-24 15:33:36 +0000
commite369538e344a366e7a0579253e0cc91b7bd37e57 (patch)
tree4b8a1a8832e905e02132d2dcf2f2780d96af90b5 /scumm
parent14f74bb56899156a5edc7ec584c368c475a528ff (diff)
downloadscummvm-rg350-e369538e344a366e7a0579253e0cc91b7bd37e57.tar.gz
scummvm-rg350-e369538e344a366e7a0579253e0cc91b7bd37e57.tar.bz2
scummvm-rg350-e369538e344a366e7a0579253e0cc91b7bd37e57.zip
free slot and return NULL when it can't open bundle file
svn-id: r13612
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp
index 7664c08713..14945070d6 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -307,6 +307,10 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
result = openMusicBundle(slot);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
+ if (!result) {
+ closeSound(&_sounds[slot]);
+ return NULL;
+ }
_sounds[slot].bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside);
_sounds[slot].soundId = soundId;
_sounds[slot].type = soundType;
@@ -323,6 +327,10 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
result = openMusicBundle(slot);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
+ if (!result) {
+ closeSound(&_sounds[slot]);
+ return NULL;
+ }
_sounds[slot].bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside);
strcpy(_sounds[slot].name, soundName);
_sounds[slot].soundId = soundId;