[Scummvm-cvs-logs] SF.net SVN: scummvm: [26040] scummvm/trunk/common/hashmap.h
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Mar 9 17:19:50 CET 2007
Revision: 26040
http://scummvm.svn.sourceforge.net/scummvm/?rev=26040&view=rev
Author: fingolfin
Date: 2007-03-09 08:19:50 -0800 (Fri, 09 Mar 2007)
Log Message:
-----------
Avoid double frees in HashMap::erase
Modified Paths:
--------------
scummvm/trunk/common/hashmap.h
Modified: scummvm/trunk/common/hashmap.h
===================================================================
--- scummvm/trunk/common/hashmap.h 2007-03-09 09:37:45 UTC (rev 26039)
+++ scummvm/trunk/common/hashmap.h 2007-03-09 16:19:50 UTC (rev 26040)
@@ -429,6 +429,8 @@
// If we remove a key, we must check all subsequent keys and possibly
// reinsert them.
uint j = i;
+ delete _arr[i];
+ _arr[i] = NULL;
while (true) {
// Look at the next table slot
j = (j + 1) % _arrsize;
@@ -440,12 +442,10 @@
uint k = _hash(_arr[j]->_key) % _arrsize;
if ((j > i && (k <= i || k > j)) ||
(j < i && (k <= i && k > j)) ) {
- delete _arr[i];
_arr[i] = _arr[j];
i = j;
}
}
- delete _arr[i];
_arr[i] = NULL;
return;
}
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