From 0aaf20adbb0458c09bd4410b27fcea4bf0af607c Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 20 Oct 2026 21:38:55 -0700 Subject: [PATCH] [3.14] gh-159739: Avoid destroying a remote unwinder cache twice (GH-159982) Leave cleanup of the code-object cache to the unwinder deallocator if allocating the thread-local bytecode cache fails. (cherry picked from commit b577a5403ad513e6f28ec28630b5ee09a5f521ab) --- .../next/Library/2026-10-20-00-00-00.gh-issue-159739.5d4269.rst | 1 + Modules/_remote_debugging_module.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.5d4269.rst diff --git a/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.5d4269.rst b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.5d4269.rst new file mode 100644 index 000000000000000..94ee3cf4790112d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.5d4269.rst @@ -0,0 +1 @@ +Fix a double free if remote unwinder initialization runs out of memory. diff --git a/Modules/_remote_debugging_module.c b/Modules/_remote_debugging_module.c index 0d11f13295df978..18f915e022b94f8 100644 --- a/Modules/_remote_debugging_module.c +++ b/Modules/_remote_debugging_module.c @@ -3277,7 +3277,6 @@ _remote_debugging_RemoteUnwinder___init___impl(RemoteUnwinderObject *self, NULL ); if (self->tlbc_cache == NULL) { - _Py_hashtable_destroy(self->code_object_cache); PyErr_NoMemory(); set_exception_cause(self, PyExc_MemoryError, "Failed to create TLBC cache"); return -1;