aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDavid Turner2010-12-14 23:30:22 +0000
committerDavid Turner2010-12-14 23:30:22 +0000
commitf2205a5a01805af76d3c85d7870a61eb76c6bbce (patch)
tree29a6a97fe64d6ad9c0fa52423da5337688afaed3 /engines
parente88fcee0579e29313a0621679bc88e1dd80a34c3 (diff)
downloadscummvm-rg350-f2205a5a01805af76d3c85d7870a61eb76c6bbce.tar.gz
scummvm-rg350-f2205a5a01805af76d3c85d7870a61eb76c6bbce.tar.bz2
scummvm-rg350-f2205a5a01805af76d3c85d7870a61eb76c6bbce.zip
SCI: Close Memory Leaks in SCI Resource Loading, reported by Valgrind.
svn-id: r54916
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/resource.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 1805b09cbe..60251ae54b 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -195,6 +195,7 @@ Resource::Resource(ResourceManager *resMan, ResourceId id) : _resMan(resMan), _i
Resource::~Resource() {
delete[] data;
+ delete[] _header;
if (_source && _source->getSourceType() == kSourcePatch)
delete _source;
}
@@ -1091,8 +1092,10 @@ ResVersion ResourceManager::detectMapVersion() {
fileStream = file;
}
break;
- } else if (rsrc->getSourceType() == kSourceMacResourceFork)
+ } else if (rsrc->getSourceType() == kSourceMacResourceFork) {
+ delete fileStream;
return kResVersionSci11Mac;
+ }
}
if (!fileStream)
@@ -1106,9 +1109,12 @@ ResVersion ResourceManager::detectMapVersion() {
// check if 0 or 01 - try to read resources in SCI0 format and see if exists
fileStream->seek(0, SEEK_SET);
while (fileStream->read(buff, 6) == 6 && !(buff[0] == 0xFF && buff[1] == 0xFF && buff[2] == 0xFF)) {
- if (findVolume(rsrc, (buff[5] & 0xFC) >> 2) == NULL)
+ if (findVolume(rsrc, (buff[5] & 0xFC) >> 2) == NULL) {
+ delete fileStream;
return kResVersionSci1Middle;
+ }
}
+ delete fileStream;
return kResVersionSci0Sci1Early;
}