[Scummvm-cvs-logs] SF.net SVN: scummvm:[44181] scummvm/branches/branch-1-0-0/engines/kyra/ staticres.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Sep 18 13:41:20 CEST 2009


Revision: 44181
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44181&view=rev
Author:   lordhoto
Date:     2009-09-18 11:41:20 +0000 (Fri, 18 Sep 2009)

Log Message:
-----------
Backport of r44180: "Fix some memory leaks, caused by a recent regression in StaticResource::unloadId."

Modified Paths:
--------------
    scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp

Modified: scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp	2009-09-18 11:38:01 UTC (rev 44180)
+++ scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp	2009-09-18 11:41:20 UTC (rev 44181)
@@ -602,13 +602,15 @@
 
 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;
 		}
 	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list