From 9652900969df77b1ac245595419431df19296af9 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Thu, 5 May 2022 23:14:09 -0500 Subject: 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. --- Objects/listobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/listobject.c b/Objects/listobject.c index 972f995..b50623e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1573,8 +1573,10 @@ static void merge_freemem(MergeState *ms) { assert(ms != NULL); - if (ms->a.keys != ms->temparray) + if (ms->a.keys != ms->temparray) { PyMem_Free(ms->a.keys); + ms->a.keys = NULL; + } } /* Ensure enough temp memory for 'need' array slots is available. -- cgit v0.12