mirror of https://github.com/python/cpython
properly handle malloc failure (closes #24044)
Patch by Christian Heimes.
This commit is contained in:
parent
893cce921c
commit
0823ffb2fb
|
@ -10,6 +10,9 @@ What's New in Python 3.2.7?
|
|||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Issue #24044: Fix possible null pointer dereference in list.sort in out of
|
||||
memory conditions.
|
||||
|
||||
- Issue #23055: Fixed a buffer overflow in PyUnicode_FromFormatV. Analysis
|
||||
and fix by Guido Vranken.
|
||||
|
||||
|
|
|
@ -1924,8 +1924,10 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
|||
keys = &ms.temparray[saved_ob_size+1];
|
||||
else {
|
||||
keys = PyMem_MALLOC(sizeof(PyObject *) * saved_ob_size);
|
||||
if (keys == NULL)
|
||||
return NULL;
|
||||
if (keys == NULL) {
|
||||
PyErr_NoMemory();
|
||||
goto keyfunc_fail;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < saved_ob_size ; i++) {
|
||||
|
|
Loading…
Reference in New Issue