diff options
author | Guido van Rossum <guido@python.org> | 2007-11-29 18:25:12 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-11-29 18:25:12 (GMT) |
commit | 31645ba4a06dcd66e84d6fdd611c5ad02401fa8c (patch) | |
tree | 7d6d21c058dd84c50740e7955e12590381bbb62b /Objects/dictobject.c | |
parent | 430e3620b6ca1dd9c881435472fdb59e57a66ad7 (diff) | |
download | cpython-31645ba4a06dcd66e84d6fdd611c5ad02401fa8c.zip cpython-31645ba4a06dcd66e84d6fdd611c5ad02401fa8c.tar.gz cpython-31645ba4a06dcd66e84d6fdd611c5ad02401fa8c.tar.bz2 |
Fix bug #1517, a segfault in lookdict().
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index bfb891c..cd1338a 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -270,7 +270,9 @@ lookdict(PyDictObject *mp, PyObject *key, register long hash) else { if (ep->me_hash == hash) { startkey = ep->me_key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (ep0 == mp->ma_table && ep->me_key == startkey) { @@ -300,7 +302,9 @@ lookdict(PyDictObject *mp, PyObject *key, register long hash) return ep; if (ep->me_hash == hash && ep->me_key != dummy) { startkey = ep->me_key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (ep0 == mp->ma_table && ep->me_key == startkey) { |