mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Handle failure of PyMem_Realloc.
This commit is contained in:
parent
9123edcc63
commit
9af2b44805
1 changed files with 4 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue