summaryrefslogtreecommitdiffstats
path: root/Modules/_io/winconsoleio.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io/winconsoleio.c')
-rw-r--r--Modules/_io/winconsoleio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 824690f..dd0997a 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -816,11 +816,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);