summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-03-28 13:53:00 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-03-28 13:53:00 (GMT)
commitcda139d1ded6708665b53e4ed32ccc1d2627e1da (patch)
tree97ffc90af733c2b54fba607d8d73b9e1d8417fd9
parent796cc6e3ad3617c1ea9e528663aac1a206230a28 (diff)
downloadcpython-cda139d1ded6708665b53e4ed32ccc1d2627e1da.zip
cpython-cda139d1ded6708665b53e4ed32ccc1d2627e1da.tar.gz
cpython-cda139d1ded6708665b53e4ed32ccc1d2627e1da.tar.bz2
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
Remove the PyMem_FREE() call added in cb90c89. The buffer will be freed when PyTokenizer_Free() is called on the tokenizer state.
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst1
-rw-r--r--Parser/tokenizer.c1
2 files changed, 1 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst
new file mode 100644
index 0000000..6c234a6
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst
@@ -0,0 +1 @@
+Fix a possible double ``PyMem_FREE()`` due to tokenizer.c's ``tok_nextc()``.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index ad05497..58dd1cd 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -963,7 +963,6 @@ tok_nextc(struct tok_state *tok)
newbuf = (char *)PyMem_REALLOC(newbuf,
newsize);
if (newbuf == NULL) {
- PyMem_FREE(tok->buf);
tok->done = E_NOMEM;
tok->cur = tok->inp;
return EOF;