From: Raymond Hettinger Date: Mon, 20 Jul 2015 05:23:32 +0000 (-0400) Subject: Issue #24583: Fix refcount leak. X-Git-Tag: v3.6.0a1~1952 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=482c05cbb5506a5332e435ffdd2c32ae62e7b9a1;p=python Issue #24583: Fix refcount leak. --- diff --git a/Objects/setobject.c b/Objects/setobject.c index fbac596e21..83bff8176c 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; }