Skip to content

Commit ae6e255

Browse files
bpo-46280: Fix tracemalloc_copy_domain() (GH-30591)
Test if tracemalloc_copy_traces() failed to allocated memory in tracemalloc_copy_domain(). (cherry picked from commit 7c770d3) Co-authored-by: Victor Stinner <[email protected]>
1 parent 537f16a commit ae6e255

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_tracemalloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,9 @@ tracemalloc_copy_domain(_Py_hashtable_t *domains,
12411241
_Py_hashtable_t *traces = (_Py_hashtable_t *)value;
12421242

12431243
_Py_hashtable_t *traces2 = tracemalloc_copy_traces(traces);
1244+
if (traces2 == NULL) {
1245+
return -1;
1246+
}
12441247
if (_Py_hashtable_set(domains2, TO_PTR(domain), traces2) < 0) {
12451248
_Py_hashtable_destroy(traces2);
12461249
return -1;

0 commit comments

Comments
 (0)