mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-141212: Fix possible memory leak in gc_mark_span_push (gh-141213)
This commit is contained in:
parent
88953d5deb
commit
f835552946
1 changed files with 3 additions and 2 deletions
|
|
@ -675,10 +675,11 @@ gc_mark_span_push(gc_span_stack_t *ss, PyObject **start, PyObject **end)
|
||||||
else {
|
else {
|
||||||
ss->capacity *= 2;
|
ss->capacity *= 2;
|
||||||
}
|
}
|
||||||
ss->stack = (gc_span_t *)PyMem_Realloc(ss->stack, ss->capacity * sizeof(gc_span_t));
|
gc_span_t *new_stack = (gc_span_t *)PyMem_Realloc(ss->stack, ss->capacity * sizeof(gc_span_t));
|
||||||
if (ss->stack == NULL) {
|
if (new_stack == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
ss->stack = new_stack;
|
||||||
}
|
}
|
||||||
assert(end > start);
|
assert(end > start);
|
||||||
ss->stack[ss->size].start = start;
|
ss->stack[ss->size].start = start;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue