summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-13 20:32:40 -0800
committerGitHub <noreply@github.com>2022-01-13 20:32:40 -0800
commit86d18019e96167c5ab6f5157fa90598202849904 (patch)
treef686fdab08550856ff691bd3976bc54b9161a416
parent47422a852de14a8ec11d058136c7c864d2cc7fc9 (diff)
downloadcpython-git-86d18019e96167c5ab6f5157fa90598202849904.tar.gz
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 7c770d3350813a82a639fcb3babae0de2b87aaae) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Modules/_tracemalloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index 90498fb7a7..ba0eb738ab 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -1241,6 +1241,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;