8000 Issues/88027: A potential double free in list_sort_impl (#92367) · python/cpython@9652900 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9652900

Browse files
authored
Issues/88027: A potential double free in list_sort_impl (#92367)
merge_freemem(): set keys to NULL do it's harmless to call this again.
1 parent 85354ed commit 9652900

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/listobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,10 @@ static void
15731573
merge_freemem(MergeState *ms)
15741574
{
15751575
assert(ms != NULL);
1576-
if (ms->a.keys != ms->temparray)
1576+
if (ms->a.keys != ms->temparray) {
15771577
PyMem_Free(ms->a.keys);
1578+
ms->a.keys = NULL;
1579+
}
15781580
}
15791581

15801582
/* Ensure enough temp memory for 'need' array slots is available.

0 commit comments

Comments
 (0)
0