diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-06-12 02:08:41 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-06-12 02:08:41 (GMT) |
commit | a00c0b97bf2772ec65f322517ade729dcbcc1cf1 (patch) | |
tree | e2a18a3d1f8bfcdc2771af6946ae2985aeff48cb /Objects | |
parent | 71e05f1e0c47670435a1552a38fedc3d44b85a1e (diff) | |
download | cpython-a00c0b97bf2772ec65f322517ade729dcbcc1cf1.zip cpython-a00c0b97bf2772ec65f322517ade729dcbcc1cf1.tar.gz cpython-a00c0b97bf2772ec65f322517ade729dcbcc1cf1.tar.bz2 |
Don't leak the list object if there's an error allocating the item storage. Backport candidate
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 105df4c..e6bed71 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -108,8 +108,10 @@ PyList_New(Py_ssize_t size) op->ob_item = NULL; else { op->ob_item = (PyObject **) PyMem_MALLOC(nbytes); - if (op->ob_item == NULL) + if (op->ob_item == NULL) { + Py_DECREF(op); return PyErr_NoMemory(); + } memset(op->ob_item, 0, nbytes); } op->ob_size = size; |