]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46280: Fix tracemalloc_copy_domain() (GH-30591)
authorVictor Stinner <vstinner@python.org>
Fri, 14 Jan 2022 04:11:38 +0000 (05:11 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Jan 2022 04:11:38 +0000 (05:11 +0100)
Test if tracemalloc_copy_traces() failed to allocated memory in
tracemalloc_copy_domain().

Modules/_tracemalloc.c

index b838439a9cb833b776bd82aa7d0ceaaf6adc51f4..14bad00e4c6291f31e7ecc8122cb38f706e08b7f 100644 (file)
@@ -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;