diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-12-07 10:11:30 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-07 10:11:30 (GMT) |
commit | 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9 (patch) | |
tree | aae3660f9a5bc462830107cf2311b2557898e268 /Python/marshal.c | |
parent | 3a521f0b6167628f975c773b56c7daf8d33d6f40 (diff) | |
download | cpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.zip cpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.tar.gz cpython-4c49da0cb7434c676d70b9ccf38aca82ac0d64a9.tar.bz2 |
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.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r-- | Python/marshal.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index 21cdd60..52932af 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -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; } |