summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-12-11 13:23:34 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-12-11 13:25:33 (GMT)
commitd8b7b7278987462791488f756edd26842d059074 (patch)
tree3027ba0b6964fc273df4c2895ee0f021bf8ab2d0 /src/corelib/tools
parentb42da2ec8677ce67ecd5d5f8188537e2a597da2a (diff)
downloadQt-d8b7b7278987462791488f756edd26842d059074.zip
Qt-d8b7b7278987462791488f756edd26842d059074.tar.gz
Qt-d8b7b7278987462791488f756edd26842d059074.tar.bz2
Fixed invalid read in QCache::unlink after recent change.
We need to store a pointer to the object in order to delete it later, since the node containing the pointer will be deleted when removing it from the hash. Reviewed-by: Jan-Arve Sæther
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qcache.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index ee9523f..086a52f 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -70,8 +70,9 @@ class QCache
if (l == &n) l = n.p;
if (f == &n) f = n.n;
total -= n.c;
+ T *object = n.t;
hash.remove(*n.keyPtr);
- delete n.t;
+ delete object;
}
inline T *relink(const Key &key) {
typename QHash<Key, Node>::iterator i = hash.find(key);