summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst1
-rw-r--r--Python/ceval.c7
2 files changed, 1 insertions, 7 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst b/Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst
new file mode 100644
index 0000000..fc12d6b
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst
@@ -0,0 +1 @@
+Fix memory leak in PyEval_EvalCodeEx.
diff --git a/Python/ceval.c b/Python/ceval.c
index be26ffd..85b4400 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -6128,16 +6128,9 @@ PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
}
allargs = newargs;
}
- PyObject **kwargs = PyMem_Malloc(sizeof(PyObject *)*kwcount);
- if (kwargs == NULL) {
- res = NULL;
- Py_DECREF(kwnames);
- goto fail;
- }
for (int i = 0; i < kwcount; i++) {
Py_INCREF(kws[2*i]);
PyTuple_SET_ITEM(kwnames, i, kws[2*i]);
- kwargs[i] = kws[2*i+1];
}
PyFrameConstructor constr = {
.fc_globals = globals,