mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
gh-159739: Avoid destroying a remote unwinder cache twice (#159982)
In a free-threaded build, if allocating the thread-local bytecode cache fails after the code-object cache has been created, the initializer destroys the first cache and returns an error without clearing its pointer. Failed construction then invokes the unwinder's deallocator, which destroys the same cache again and can crash the profiling process instead of propagating `MemoryError`.
This commit is contained in:
1 parent
fab1405da8
commit
b577a5403a
2 files changed
+1
-1
No files matched your search
@@ -0,0 +1 @@
|
||||
Fix a double free if remote unwinder initialization runs out of memory.
|
||||
@@ -450,7 +450,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;
|
||||
|
||||
Reference in new issue
Block a user