summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Wirtel <stephane@wirtel.be>2019-03-19 10:51:32 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-03-19 10:51:32 (GMT)
commit943395fab925a11ea90d078e771cdfc4443e8c34 (patch)
treec34e7f3cea05bede1a8cdf4be432eadd803b0696
parente130a07eb20c4b655d182d5d10d778c7584efe55 (diff)
downloadcpython-943395fab925a11ea90d078e771cdfc4443e8c34.zip
cpython-943395fab925a11ea90d078e771cdfc4443e8c34.tar.gz
cpython-943395fab925a11ea90d078e771cdfc4443e8c34.tar.bz2
bpo-36333: Fix leak _PyRuntimeState_Fini (GH-12400)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-03-18-10-56-53.bpo-36333.4dqemZ.rst1
-rw-r--r--Python/pystate.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-18-10-56-53.bpo-36333.4dqemZ.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-18-10-56-53.bpo-36333.4dqemZ.rst
new file mode 100644
index 0000000..e5af44f
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-18-10-56-53.bpo-36333.4dqemZ.rst
@@ -0,0 +1 @@
+Fix leak in _PyRuntimeState_Fini. Contributed by Stéphane Wirtel.
diff --git a/Python/pystate.c b/Python/pystate.c
index 6a2dc10..36566b7 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -92,6 +92,11 @@ _PyRuntimeState_Fini(_PyRuntimeState *runtime)
runtime->interpreters.mutex = NULL;
}
+ if (runtime->xidregistry.mutex != NULL) {
+ PyThread_free_lock(runtime->xidregistry.mutex);
+ runtime->xidregistry.mutex = NULL;
+ }
+
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
}