Check for memory alloc failure

This commit is contained in:
Neal Norwitz 2008-06-13 06:00:46 +00:00
parent a4dd2e20e2
commit e9ee44c25b
1 changed files with 2 additions and 0 deletions

View File

@ -1849,6 +1849,8 @@ buffer_info(PyObject *self, PyObject *arg)
return NULL;
}
shape = PyTuple_New(dict->ndim);
if (shape == NULL)
return NULL;
for (i = 0; i < (int)dict->ndim; ++i)
PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i]));