summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-07 16:09:23 (GMT)
committerGitHub <noreply@github.com>2018-12-07 16:09:23 (GMT)
commit2d6bc25dbc3dc5662f13917eb759f92842bf6de6 (patch)
treed1dde41b6c7e9c5dafa95703bd4f0a4ab6b2bfb7 /Python/marshal.c
parent19f6e83bf03b3ce22300638906bd90dd2dd5c463 (diff)
downloadcpython-2d6bc25dbc3dc5662f13917eb759f92842bf6de6.zip
cpython-2d6bc25dbc3dc5662f13917eb759f92842bf6de6.tar.gz
cpython-2d6bc25dbc3dc5662f13917eb759f92842bf6de6.tar.bz2
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015) (GH-11020) (GH-11026)
(cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9) (cherry picked from commit 602d307ac5e8a2da38a193dca3bdfef5994dfe67) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 91a57c2..dbe75e3 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -677,11 +677,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;
}