diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-05-06 04:38:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 04:38:14 (GMT) |
commit | 0eef443f0142b8cee705a22d0d1c9df17be94f69 (patch) | |
tree | bccad2a3bdc552b5f350bba18bb2cb8328db9c09 /Objects | |
parent | 2a2421e538f9f7ceb419074909a313ba2c46f384 (diff) | |
download | cpython-0eef443f0142b8cee705a22d0d1c9df17be94f69.zip cpython-0eef443f0142b8cee705a22d0d1c9df17be94f69.tar.gz cpython-0eef443f0142b8cee705a22d0d1c9df17be94f69.tar.bz2 |
Issues/88027: A potential double free in list_sort_impl (GH-92367)
merge_freemem(): set keys to NULL do it's harmless to call this again.
(cherry picked from commit 9652900969df77b1ac245595419431df19296af9)
Co-authored-by: Tim Peters <tim.peters@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 533ee74..d3bc576 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1548,8 +1548,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. |