[Python-checkins] bpo-46280: Fix tracemalloc_copy_domain() (GH-30591)
vstinner
webhook-mailer at python.org
Thu Jan 13 23:11:47 EST 2022
https://github.com/python/cpython/commit/7c770d3350813a82a639fcb3babae0de2b87aaae
commit: 7c770d3350813a82a639fcb3babae0de2b87aaae
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-01-14T05:11:38+01:00
summary:
bpo-46280: Fix tracemalloc_copy_domain() (GH-30591)
Test if tracemalloc_copy_traces() failed to allocated memory in
tracemalloc_copy_domain().
files:
M Modules/_tracemalloc.c
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index b838439a9cb83..14bad00e4c629 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;
More information about the Python-checkins
mailing list