mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015)
Set MemoryError when appropriate, add missing failure checks, and fix some potential leaks.
This commit is contained in:
parent
3a521f0b61
commit
4c49da0cb7
17 changed files with 113 additions and 27 deletions
|
@ -670,11 +670,12 @@ r_string(Py_ssize_t n, RFILE *p)
|
|||
p->buf_size = n;
|
||||
}
|
||||
else if (p->buf_size < n) {
|
||||
p->buf = PyMem_REALLOC(p->buf, n);
|
||||
if (p->buf == NULL) {
|
||||
char *tmp = PyMem_REALLOC(p->buf, n);
|
||||
if (tmp == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
p->buf = tmp;
|
||||
p->buf_size = n;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue