diff options
| author | Zackery Spytz <zspytz@gmail.com> | 2018-12-07 05:17:43 -0700 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-07 14:17:43 +0200 |
| commit | 602d307ac5e8a2da38a193dca3bdfef5994dfe67 (patch) | |
| tree | 8e876e0142683a7564a391dc6396bc6d33f08639 /Modules/_io | |
| parent | 2db190bb356d00422087e1286637887efb8d97c5 (diff) | |
| download | cpython-git-602d307ac5e8a2da38a193dca3bdfef5994dfe67.tar.gz | |
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015) (GH-11020)
(cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9)
Diffstat (limited to 'Modules/_io')
| -rw-r--r-- | Modules/_io/winconsoleio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index 4d3d695e42..c11c1e09f4 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -815,11 +815,13 @@ _io__WindowsConsoleIO_readall_impl(winconsoleio *self) } bufsize = newsize; - buf = PyMem_Realloc(buf, (bufsize + 1) * sizeof(wchar_t)); - if (!buf) { + wchar_t *tmp = PyMem_Realloc(buf, + (bufsize + 1) * sizeof(wchar_t)); + if (tmp == NULL) { PyMem_Free(buf); return NULL; } + buf = tmp; } subbuf = read_console_w(self->handle, bufsize - len, &n); |
