aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2009-09-18 11:38:01 +0000
committerJohannes Schickel2009-09-18 11:38:01 +0000
commite4fd4e827ca95733e29114ee955b5dd4a26cb16f (patch)
tree70bb97fc3ce09075085d35a03afee97c9a516d57 /engines/kyra
parent559f1f087ba71dd19c445ae0d887fef1e1bce77b (diff)
downloadscummvm-rg350-e4fd4e827ca95733e29114ee955b5dd4a26cb16f.tar.gz
scummvm-rg350-e4fd4e827ca95733e29114ee955b5dd4a26cb16f.tar.bz2
scummvm-rg350-e4fd4e827ca95733e29114ee955b5dd4a26cb16f.zip
Fix some memory leaks, caused by a recent regression in StaticResource::unloadId.
svn-id: r44180
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/staticres.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 88bc2e984c..d12c918b12 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -603,13 +603,15 @@ bool StaticResource::prefetchId(int id) {
void StaticResource::unloadId(int id) {
Common::List<ResData>::iterator pos = _resList.begin();
- for (; pos != _resList.end(); ++pos) {
+ for (; pos != _resList.end();) {
if (pos->id == id || id == -1) {
const FileType *filetype = getFiletype(pos->type);
(this->*(filetype->free))(pos->data, pos->size);
pos = _resList.erase(pos);
if (id != -1)
break;
+ } else {
+ ++pos;
}
}
}