]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-120811: Fix reference leak upon `_PyContext_Exit` failure (GH-120812) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 22 Jun 2024 11:14:31 +0000 (13:14 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jun 2024 11:14:31 +0000 (16:44 +0530)
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (GH-120812)
(cherry picked from commit aed31beca9a54b85a1392631a48da80602210f18)

Co-authored-by: Peter <zintensitydev@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst [new file with mode: 0644]
Python/context.c

diff --git a/Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst b/Misc/NEWS.d/next/Library/2024-06-21-14-32-56.gh-issue-120811.eBmVTV.rst
new file mode 100644 (file)
index 0000000..62cd7b5
--- /dev/null
@@ -0,0 +1 @@
+Fix possible memory leak in :meth:`contextvars.Context.run`.
index 1ffae9871be7b3f3982369a00c0891ef1c5c82e9..7bccfad11a45b1f8395248b8e92ce72061b6a3ab 100644 (file)
@@ -669,6 +669,7 @@ context_run(PyContext *self, PyObject *const *args,
         ts, args[0], args + 1, nargs - 1, kwnames);
 
     if (_PyContext_Exit(ts, (PyObject *)self)) {
+        Py_XDECREF(call_result);
         return NULL;
     }