aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2010-08-02 22:27:26 +0000
committerJohannes Schickel2010-08-02 22:27:26 +0000
commitdd38e424e7ec87990019f4a811fdc25c62fe1729 (patch)
treea5835355d6e56db73a2680e5c8aecb0b9d3f2ad8 /engines
parenta1001731fa50c730dcf834b724edfb89a8352298 (diff)
downloadscummvm-rg350-dd38e424e7ec87990019f4a811fdc25c62fe1729.tar.gz
scummvm-rg350-dd38e424e7ec87990019f4a811fdc25c62fe1729.tar.bz2
scummvm-rg350-dd38e424e7ec87990019f4a811fdc25c62fe1729.zip
SCI: Fix leaks in ResourceManager::listResources caller code.
svn-id: r51666
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/console.cpp3
-rw-r--r--engines/sci/detection.cpp2
-rw-r--r--engines/sci/engine/features.cpp3
-rw-r--r--engines/sci/engine/kscripts.cpp1
-rw-r--r--engines/sci/resource.cpp1
5 files changed, 8 insertions, 2 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 7407f08482..bac31f6c8e 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -844,6 +844,7 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) {
}
DebugPrintf("SCI1.1-SCI2.1 script check finished\n");
+ delete resources;
return true;
}
@@ -1006,6 +1007,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
DebugPrintf("\n\n");
}
+ delete resources;
return true;
}
@@ -1051,7 +1053,6 @@ bool Console::cmdList(int argc, const char **argv) {
++itr;
}
DebugPrintf("\n");
-
delete resources;
}
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 3a8e10fd84..e330bd5f30 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -299,7 +299,7 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
if (sierraId == "fp" || sierraId == "gk" || sierraId == "pq4")
demoThreshold = 150;
- Common::List<ResourceId> *resources = resMan->listResources(kResourceTypeScript, -1);
+ Common::ScopedPtr<Common::List<ResourceId> > resources(resMan->listResources(kResourceTypeScript, -1));
if (resources->size() < demoThreshold) {
*gameFlags |= ADGF_DEMO;
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index ad6d4d728d..f99d412c64 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -438,6 +438,8 @@ SciVersion GameFeatures::detectMessageFunctionType() {
Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1);
if (resources->empty()) {
+ delete resources;
+
// No messages found, so this doesn't really matter anyway...
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
@@ -445,6 +447,7 @@ SciVersion GameFeatures::detectMessageFunctionType() {
Resource *res = g_sci->getResMan()->findResource(*resources->begin(), false);
assert(res);
+ delete resources;
// Only v2 Message resources use the kGetMessage kernel function.
// v3-v5 use the kMessage kernel function.
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index e211867ef9..a5501c160f 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -95,6 +95,7 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) {
++itr;
}
+ delete resources;
} else {
which = g_sci->getResMan()->findResource(id, 0);
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 2fdf091314..d59b21eef6 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -665,6 +665,7 @@ int ResourceManager::addInternalSources() {
++itr;
}
+ delete resources;
return 1;
}