summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMatthias Reichl <github@hias.horus.com>2021-10-07 22:46:49 (GMT)
committerGitHub <noreply@github.com>2021-10-07 22:46:49 (GMT)
commit392a89835371baa0fc4bf79ae479abb80661f57d (patch)
treed890cc3705761151efb026af5ec1099801fff5eb /Modules
parent0219017df7ec41839fd0d56a3076b5f09c58d313 (diff)
downloadcpython-392a89835371baa0fc4bf79ae479abb80661f57d.zip
cpython-392a89835371baa0fc4bf79ae479abb80661f57d.tar.gz
cpython-392a89835371baa0fc4bf79ae479abb80661f57d.tar.bz2
bpo-45262, asyncio: Fix cache of the running loop holder (GH-28796)
Prevent use-after-free of running loop holder via cache.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_asynciomodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index ecc73d1c..56079b0 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -3239,6 +3239,9 @@ new_running_loop_holder(PyObject *loop)
static void
PyRunningLoopHolder_tp_dealloc(PyRunningLoopHolder *rl)
{
+ if (cached_running_holder == (PyObject *)rl) {
+ cached_running_holder = NULL;
+ }
Py_CLEAR(rl->rl_loop);
PyObject_Free(rl);
}