Skip to content

Commit

Permalink
bpo-46280: Fix tracemalloc_copy_domain() (pythonGH-30591)
Browse files Browse the repository at this point in the history
Test if tracemalloc_copy_traces() failed to allocated memory in
tracemalloc_copy_domain().
  • Loading branch information
vstinner authored Jan 14, 2022
1 parent 322f962 commit 7c770d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Modules/_tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,9 @@ tracemalloc_copy_domain(_Py_hashtable_t *domains,
_Py_hashtable_t *traces = (_Py_hashtable_t *)value;

_Py_hashtable_t *traces2 = tracemalloc_copy_traces(traces);
if (traces2 == NULL) {
return -1;
}
if (_Py_hashtable_set(domains2, TO_PTR(domain), traces2) < 0) {
_Py_hashtable_destroy(traces2);
return -1;
Expand Down

0 comments on commit 7c770d3

Please sign in to comment.