Skip to content

Commit 7c770d3

Browse files
authored
bpo-46280: Fix tracemalloc_copy_domain() (pythonGH-30591)
Test if tracemalloc_copy_traces() failed to allocated memory in tracemalloc_copy_domain().
1 parent 322f962 commit 7c770d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_tracemalloc.c

+3
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,9 @@ tracemalloc_copy_domain(_Py_hashtable_t *domains,
12421242
_Py_hashtable_t *traces = (_Py_hashtable_t *)value;
12431243

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

0 commit comments

Comments
 (0)