bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015) (GH-11020)

(cherry picked from commit 4c49da0cb7)
This commit is contained in:
Zackery Spytz 2018-12-07 05:17:43 -07:00 committed by Serhiy Storchaka
parent 2db190bb35
commit 602d307ac5
16 changed files with 109 additions and 24 deletions

View file

@ -689,11 +689,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;
}