summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel.stutzbach@google.com>2011-05-04 19:46:28 (GMT)
committerDaniel Stutzbach <daniel.stutzbach@google.com>2011-05-04 19:46:28 (GMT)
commiteda70b81d3346f1831efe0f1b9553ef9f1bb4ca3 (patch)
tree54b3b82803e1158016cd2dd505cf7e1812007633 /Objects
parent0d5e52d3469a310001afe50689f77ddba6d554d1 (diff)
downloadcpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.zip
cpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.tar.gz
cpython-eda70b81d3346f1831efe0f1b9553ef9f1bb4ca3.tar.bz2
#11335: Fix memory leak after key function failure in sort
Diffstat (limited to 'Objects')
-rw-r--r--Objects/listobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 18713ab..73624f0 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -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;
}
}