mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
#11335: Fix memory leak after key function failure in sort
This commit is contained in:
parent
0d5e52d346
commit
eda70b81d3
2 changed files with 8 additions and 0 deletions
|
@ -1944,6 +1944,8 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
|||
if (keys[i] == NULL) {
|
||||
for (i=i-1 ; i>=0 ; i--)
|
||||
Py_DECREF(keys[i]);
|
||||
if (keys != &ms.temparray[saved_ob_size+1])
|
||||
PyMem_FREE(keys);
|
||||
goto keyfunc_fail;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue