[Python-checkins] cpython (2.7): fix possible refleak (closes #14752)
benjamin.peterson
python-checkins at python.org
Tue May 8 15:23:15 CEST 2012
http://hg.python.org/cpython/rev/5319a4bf72e7
changeset: 76837:5319a4bf72e7
branch: 2.7
parent: 76832:72df255a7716
user: Benjamin Peterson <benjamin at python.org>
date: Tue May 08 09:22:24 2012 -0400
summary:
fix possible refleak (closes #14752)
files:
Objects/typeobject.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -3565,6 +3565,7 @@
for (; meth->ml_name != NULL; meth++) {
PyObject *descr;
+ int err;
if (PyDict_GetItemString(dict, meth->ml_name) &&
!(meth->ml_flags & METH_COEXIST))
continue;
@@ -3588,9 +3589,10 @@
}
if (descr == NULL)
return -1;
- if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0)
+ err = PyDict_SetItemString(dict, meth->ml_name, descr);
+ Py_DECREF(descr);
+ if (err < 0)
return -1;
- Py_DECREF(descr);
}
return 0;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list