From e4fd4e827ca95733e29114ee955b5dd4a26cb16f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 18 Sep 2009 11:38:01 +0000 Subject: Fix some memory leaks, caused by a recent regression in StaticResource::unloadId. svn-id: r44180 --- engines/kyra/staticres.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/kyra') 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::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; } } } -- cgit v1.2.3