Issue #27942: Fix memory leak in codeobject.c

This commit is contained in:
Yury Selivanov 2016-11-09 09:41:15 -05:00
parent a8760275bd
commit 48aa605337
1 changed files with 2 additions and 0 deletions

View File

@ -65,6 +65,7 @@ intern_string_constants(PyObject *tuple)
intern_string_constants(v); intern_string_constants(v);
} }
else if (PyFrozenSet_CheckExact(v)) { else if (PyFrozenSet_CheckExact(v)) {
PyObject *w = v;
PyObject *tmp = PySequence_Tuple(v); PyObject *tmp = PySequence_Tuple(v);
if (tmp == NULL) { if (tmp == NULL) {
PyErr_Clear(); PyErr_Clear();
@ -77,6 +78,7 @@ intern_string_constants(PyObject *tuple)
} }
else { else {
PyTuple_SET_ITEM(tuple, i, v); PyTuple_SET_ITEM(tuple, i, v);
Py_DECREF(w);
modified = 1; modified = 1;
} }
} }