summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-09 14:42:14 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-09 14:42:14 (GMT)
commitd2fd3599abeed393ccdf4ee5cf1c7b346ba4a022 (patch)
tree396e99bdb5e58ca4b353aa640b51ed7b1a9bb2c0
parent58c534dd6cac474776e173fbeb06efbf46aff028 (diff)
downloadcpython-d2fd3599abeed393ccdf4ee5cf1c7b346ba4a022.zip
cpython-d2fd3599abeed393ccdf4ee5cf1c7b346ba4a022.tar.gz
cpython-d2fd3599abeed393ccdf4ee5cf1c7b346ba4a022.tar.bz2
ssue #27942: Fix memory leak in codeobject.c
-rw-r--r--Misc/NEWS2
-rw-r--r--Objects/codeobject.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 7512e1a..10ec9e0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -110,6 +110,8 @@ Core and Builtins
- Issue #27443: __length_hint__() of bytearray iterators no longer return a
negative integer for a resized bytearray.
+- Issue #27942: Fix memory leak in codeobject.c
+
Library
-------
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 9df87b0..c334626 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -69,6 +69,7 @@ intern_string_constants(PyObject *tuple)
intern_string_constants(v);
}
else if (PyFrozenSet_CheckExact(v)) {
+ PyObject *w = v;
PyObject *tmp = PySequence_Tuple(v);
if (tmp == NULL) {
PyErr_Clear();
@@ -81,6 +82,7 @@ intern_string_constants(PyObject *tuple)
}
else {
PyTuple_SET_ITEM(tuple, i, v);
+ Py_DECREF(w);
modified = 1;
}
}