mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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_ptr = ptr;
|
||||||
obj->b_size = size;
|
obj->b_size = size;
|
||||||
} else {
|
} 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;
|
obj->b_size = size;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue