]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46347: Fix memory leak in PyEval_EvalCodeEx. (#30546)
authorYury Selivanov <yury@edgedb.com>
Tue, 11 Jan 2022 22:25:28 +0000 (14:25 -0800)
committerGitHub <noreply@github.com>
Tue, 11 Jan 2022 22:25:28 +0000 (14:25 -0800)
First introduced in 0332e569c12d3dc97171546c6dc10e42c27de34b

Misc/NEWS.d/next/Core and Builtins/2022-01-11-13-57-00.bpo-46347.Gd8M-S.rst [new file with mode: 0644]
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 (file)
index 0000000..fc12d6b
--- /dev/null
@@ -0,0 +1 @@
+Fix memory leak in PyEval_EvalCodeEx.
index be26ffd822c1362dd039a0386ec5285e9c419ae5..85b4400de32f4935ee80b2cbe8a7c20a4bb694e3 100644 (file)
@@ -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,