Kaydet (Commit) a00c0b97 authored tarafından Neal Norwitz's avatar Neal Norwitz

Don't leak the list object if there's an error allocating the item storage. Backport candidate

üst 71e05f1e
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment