diff options
author | Raymond Hettinger <python@rcn.com> | 2015-07-20 05:23:32 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-07-20 05:23:32 (GMT) |
commit | 482c05cbb5506a5332e435ffdd2c32ae62e7b9a1 (patch) | |
tree | e42d9100d7dfef1c818f21285413db9642737ecc | |
parent | cfe5b6ca04a14ef1ba42e78bf6da05cfa9c0b66b (diff) | |
download | cpython-482c05cbb5506a5332e435ffdd2c32ae62e7b9a1.zip cpython-482c05cbb5506a5332e435ffdd2c32ae62e7b9a1.tar.gz cpython-482c05cbb5506a5332e435ffdd2c32ae62e7b9a1.tar.bz2 |
Issue #24583: Fix refcount leak.
-rw-r--r-- | Objects/setobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index fbac596..83bff81 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -223,9 +223,13 @@ _set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) entry->hash = hash; if ((size_t)so->fill*3 < mask*2) return 0; - return set_table_resize(so, so->used); + if (!set_table_resize(so, so->used)) + return 0; + Py_INCREF(key); + return -1; found_active: + Py_DECREF(key); return 0; } |