avoid referencing past the bounds of an array

This commit is contained in:
Benjamin Peterson 2014-03-15 12:21:28 -05:00
parent c77e7a4f23
commit 4a42cd48d5
1 changed files with 1 additions and 1 deletions

View File

@ -1963,7 +1963,7 @@ 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])
if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2)
PyMem_FREE(keys);
goto keyfunc_fail;
}