Handle failure of PyMem_Realloc.

This commit is contained in:
Thomas Heller 2006-06-10 22:01:50 +00:00
parent 9123edcc63
commit 9af2b44805

View file

@ -1492,7 +1492,10 @@ resize(PyObject *self, PyObject *args)
obj->b_ptr = ptr;
obj->b_size = size;
} else {
obj->b_ptr = PyMem_Realloc(obj->b_ptr, size);
void * ptr = PyMem_Realloc(obj->b_ptr, size);
if (ptr == NULL)
return PyErr_NoMemory();
obj->b_ptr = ptr;
obj->b_size = size;
}
done: