diff options
author | Guido van Rossum <guido@python.org> | 2003-04-15 22:09:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-15 22:09:45 (GMT) |
commit | 19a02ba69dd908bcc5fe45263fb9c956ed9f7ffc (patch) | |
tree | 85c9a1efe41f3a06e0a12aba5dabcfce0d39ba77 /Objects | |
parent | 4323090d95b2bce141dedd2577f37fa06da04cf2 (diff) | |
download | cpython-19a02ba69dd908bcc5fe45263fb9c956ed9f7ffc.zip cpython-19a02ba69dd908bcc5fe45263fb9c956ed9f7ffc.tar.gz cpython-19a02ba69dd908bcc5fe45263fb9c956ed9f7ffc.tar.bz2 |
Fix three (!) object leaks in the code for assignment to __bases__.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6ef5f75..8f9deae 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -164,10 +164,12 @@ mro_subclasses(PyTypeObject *type, PyObject* temp) else { PyObject* tuple; tuple = Py_BuildValue("OO", subclass, old_mro); + Py_DECREF(old_mro); if (!tuple) return -1; if (PyList_Append(temp, tuple) < 0) return -1; + Py_DECREF(tuple); } if (mro_subclasses(subclass, temp) < 0) return -1; @@ -256,7 +258,7 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context) for (i = 0; i < PyList_Size(temp); i++) { PyTypeObject* cls; PyObject* mro; - PyArg_ParseTuple(PyList_GetItem(temp, i), + PyArg_ParseTuple(PyList_GET_ITEM(temp, i), "OO", &cls, &mro); Py_DECREF(cls->tp_mro); cls->tp_mro = mro; |