summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2022-05-06 04:14:09 (GMT)
committerGitHub <noreply@github.com>2022-05-06 04:14:09 (GMT)
commit9652900969df77b1ac245595419431df19296af9 (patch)
treeb66e654506c7103b622c47012dd52412f8ff79a3 /Objects
parent85354ed78c0edb6d81a2bd53cabc85e547b8b26e (diff)
downloadcpython-9652900969df77b1ac245595419431df19296af9.zip
cpython-9652900969df77b1ac245595419431df19296af9.tar.gz
cpython-9652900969df77b1ac245595419431df19296af9.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c4
1 files changed, 3 insertions, 1 deletions
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.