gh-140067: Fix memory leak in sub-interpreter creation (#140111) (#140261)

Fix memory leak in sub-interpreter creation caused by overwriting of the previously used `_malloced` field. Now the pointer is stored in the first word of the memory block to avoid it being overwritten accidentally. 

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Kumar Aditya 2025-10-18 16:36:58 +05:30 committed by GitHub
parent c8729c9909
commit 58c44c2bf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 12 deletions

View file

@ -1776,6 +1776,7 @@ def task():
self.assertEqual(os.read(r_interp, 1), DONE)
@cpython_only
@support.skip_if_sanitizer(thread=True, memory=True)
def test_daemon_threads_fatal_error(self):
import_module("_testcapi")
subinterp_code = f"""if 1: