[3.13] gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391) (#121392)

gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc42f9)

Co-authored-by: Josh Brobst <jbrobst@proton.me>
This commit is contained in:
Miss Islington (bot) 2024-07-21 15:12:13 +02:00 committed by GitHub
parent 66435241d8
commit 4b76404a51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -838,7 +838,7 @@ _PyTraceMalloc_Init(void)
tracemalloc_tracebacks = hashtable_new(hashtable_hash_traceback,
hashtable_compare_traceback,
NULL, raw_free);
raw_free, NULL);
tracemalloc_traces = tracemalloc_create_traces_table();
tracemalloc_domains = tracemalloc_create_domains_table();