diff options
author | Willem Jan Palenstijn | 2012-01-15 18:25:00 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2012-01-15 18:25:00 +0100 |
commit | 56fb56936e36b3a91ab575a78514383199388ed9 (patch) | |
tree | d3600ad7d0ea29615a2afac4ca247f20ed408e75 /engines/sci/engine/kscripts.cpp | |
parent | f2c163a5690d20e41ff39245242e7cc0b9eed8eb (diff) | |
download | scummvm-rg350-56fb56936e36b3a91ab575a78514383199388ed9.tar.gz scummvm-rg350-56fb56936e36b3a91ab575a78514383199388ed9.tar.bz2 scummvm-rg350-56fb56936e36b3a91ab575a78514383199388ed9.zip |
SCI: Clean up some memory management and loops
Diffstat (limited to 'engines/sci/engine/kscripts.cpp')
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 93c1fffe3c..9b0e490d7e 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -74,17 +74,13 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) { case 0 : if (id.getNumber() == 0xFFFF) { // Unlock all resources of the requested type - Common::List<ResourceId> *resources = g_sci->getResMan()->listResources(type); - Common::List<ResourceId>::iterator itr = resources->begin(); - - while (itr != resources->end()) { + Common::List<ResourceId> resources = g_sci->getResMan()->listResources(type); + Common::List<ResourceId>::iterator itr; + for (itr = resources.begin(); itr != resources.end(); ++itr) { Resource *res = g_sci->getResMan()->testResource(*itr); if (res->isLocked()) g_sci->getResMan()->unlockResource(res); - ++itr; } - - delete resources; } else { which = g_sci->getResMan()->findResource(id, 0); |