[Python-checkins] bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (#30546)
1st1
webhook-mailer at python.org
Tue Jan 11 17:25:40 EST 2022
https://github.com/python/cpython/commit/607d8a838f29ad3c4c4e85b39f338dade5f9cafe
commit: 607d8a838f29ad3c4c4e85b39f338dade5f9cafe
branch: main
author: Yury Selivanov <yury at edgedb.com>
committer: 1st1 <yury at edgedb.com>
date: 2022-01-11T14:25:28-08:00
summary:
bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (#30546)
First introduced in 0332e569c12d3dc97171546c6dc10e42c27de34b
files:
A Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst
M Python/ceval.c
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 0000000000000..fc12d6ba146ca
--- /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 be26ffd822c13..85b4400de32f4 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,
More information about the Python-checkins
mailing list