Skip to content

Commit 62b3b0d

Browse files
ZeroIntensitykumaraditya303
authored andcommitted
pythongh-120811: Fix reference leak upon _PyContext_Exit failure (python#120812)
Co-authored-by: Kumar Aditya <[email protected]>
1 parent f5e36f5 commit 62b3b0d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix possible memory leak in :meth:`contextvars.Context.run`.

Python/context.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ context_run(PyContext *self, PyObject *const *args,
661661
ts, args[0], args + 1, nargs - 1, kwnames);
662662

663663
if (_PyContext_Exit(ts, (PyObject *)self)) {
664+
Py_XDECREF(call_result);
664665
return NULL;
665666
}
666667

0 commit comments

Comments
 (0)