[Python-checkins] Issues/88027: A potential double free in list_sort_impl (#92367)
tim-one
webhook-mailer at python.org
Fri May 6 00:14:18 EDT 2022
https://github.com/python/cpython/commit/9652900969df77b1ac245595419431df19296af9
commit: 9652900969df77b1ac245595419431df19296af9
branch: main
author: Tim Peters <tim.peters at gmail.com>
committer: tim-one <tim.peters at gmail.com>
date: 2022-05-05T23:14:09-05:00
summary:
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.
files:
M Objects/listobject.c
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 972f99582163b..b50623ed73d94 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.
More information about the Python-checkins
mailing list