[Scummvm-cvs-logs] SF.net SVN: scummvm:[34928] scummvm/trunk/common/archive.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Nov 7 14:42:05 CET 2008


Revision: 34928
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34928&view=rev
Author:   lordhoto
Date:     2008-11-07 13:42:05 +0000 (Fri, 07 Nov 2008)

Log Message:
-----------
Fixed leak when using SearchSet::add for an already existing name.

Modified Paths:
--------------
    scummvm/trunk/common/archive.cpp

Modified: scummvm/trunk/common/archive.cpp
===================================================================
--- scummvm/trunk/common/archive.cpp	2008-11-07 13:20:25 UTC (rev 34927)
+++ scummvm/trunk/common/archive.cpp	2008-11-07 13:42:05 UTC (rev 34928)
@@ -299,17 +299,19 @@
 	_list.insert(it, node);
 }
 
-void SearchSet::add(const String& name, Archive *archive, int priority, bool autoFree) {
+void SearchSet::add(const String &name, Archive *archive, int priority, bool autoFree) {
 	if (find(name) == _list.end()) {
 		Node node(priority, name, archive, autoFree);
 		insert(node);
 	} else {
+		if (autoFree)
+			delete archive;
 		warning("SearchSet::add: archive '%s' already present", name.c_str());
 	}
 
 }
 
-void SearchSet::remove(const String& name) {
+void SearchSet::remove(const String &name) {
 	ArchiveList::iterator it = find(name);
 	if (it != _list.end()) {
 		if (it->_autoFree)
@@ -331,7 +333,7 @@
 	_list.clear();
 }
 
-void SearchSet::setPriority(const String& name, int priority) {
+void SearchSet::setPriority(const String &name, int priority) {
 	ArchiveList::iterator it = find(name);
 	if (it == _list.end()) {
 		warning("SearchSet::setPriority: archive '%s' is not present", name.c_str());


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