bpo-41995: Fix null ptr deref in tracemalloc_copy_trace() (GH-22660)

Fix a null pointer dereference in tracemalloc_copy_trace()
of _tracemalloc.
(cherry picked from commit 66c28f50c7)

Co-authored-by: Yunlongs <lylgood@foxmail.com>
This commit is contained in:
Miss Skeleton (bot) 2020-10-13 00:09:08 -07:00 committed by GitHub
parent 15ef19f7d7
commit afe86066e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1199,7 +1199,7 @@ tracemalloc_copy_trace(_Py_hashtable_t *traces,
trace_t *trace = (trace_t *)value;
trace_t *trace2 = raw_malloc(sizeof(trace_t));
if (traces2 == NULL) {
if (trace2 == NULL) {
return -1;
}
*trace2 = *trace;