summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-14 04:11:38 (GMT)
committerGitHub <noreply@github.com>2022-01-14 04:11:38 (GMT)
commit7c770d3350813a82a639fcb3babae0de2b87aaae (patch)
tree88147495aa582e319f7407356eb2fd666bfaceae /Modules
parent322f962f3ee31d0dbde99e36379de8488ccc6804 (diff)
downloadcpython-7c770d3350813a82a639fcb3babae0de2b87aaae.zip
cpython-7c770d3350813a82a639fcb3babae0de2b87aaae.tar.gz
cpython-7c770d3350813a82a639fcb3babae0de2b87aaae.tar.bz2
bpo-46280: Fix tracemalloc_copy_domain() (GH-30591)
Test if tracemalloc_copy_traces() failed to allocated memory in tracemalloc_copy_domain().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_tracemalloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index b838439..14bad00 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -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;