changeset: 95788:80485b8e43cd branch: 3.4 parent: 95784:0f9c43fb189d parent: 95787:0d8f15053f42 user: Benjamin Peterson date: Thu Apr 23 17:06:33 2015 -0400 files: Misc/NEWS Objects/listobject.c description: merge 3.3 (#24044) diff -r 0f9c43fb189d -r 80485b8e43cd Misc/NEWS --- a/Misc/NEWS Thu Apr 23 11:24:14 2015 +0200 +++ b/Misc/NEWS Thu Apr 23 17:06:33 2015 -0400 @@ -28,6 +28,9 @@ - Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects. +- Issue #24044: Fix possible null pointer dereference in list.sort in out of + memory conditions. + Library ------- diff -r 0f9c43fb189d -r 80485b8e43cd Objects/listobject.c --- a/Objects/listobject.c Thu Apr 23 11:24:14 2015 +0200 +++ b/Objects/listobject.c Thu Apr 23 17:06:33 2015 -0400 @@ -1961,8 +1961,10 @@ 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++) {