aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-05-25 12:47:58 +0000
committerJohannes Schickel2009-05-25 12:47:58 +0000
commitcb5c26dd53d749e355ab30209a81a89fa9289eba (patch)
tree559e7ec36eaf063b3647198d4e51e0e75dd72a39
parentc7d9e4dc0c5db02288bfc3d274f469e394e6b288 (diff)
downloadscummvm-rg350-cb5c26dd53d749e355ab30209a81a89fa9289eba.tar.gz
scummvm-rg350-cb5c26dd53d749e355ab30209a81a89fa9289eba.tar.bz2
scummvm-rg350-cb5c26dd53d749e355ab30209a81a89fa9289eba.zip
- Fix various valgrind warnings in the audio sync code
- Fix crash when qutting KQ 5 CD (It was caused by resources of type "kResourceTypeSync" getting allocated an "Resource" object instead of an "ResourceSync" object, I hope this is the correct fix) svn-id: r40888
-rw-r--r--engines/sci/resource.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index dd9e5f54fd..c9faaf0231 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -985,7 +985,15 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
resId = RESOURCE_HASH(type, number);
// adding new resource only if it does not exist
if (_resMap.contains(resId) == false) {
- res = new Resource;
+ switch (type) {
+ case kResourceTypeSync:
+ res = new ResourceSync;
+ break;
+ default:
+ res = new Resource;
+ break;
+ }
+
_resMap.setVal(resId, res);
res->type = (ResourceType)type;
res->number = number;