summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-03-28 08:08:35 -0700
committerGitHub <noreply@github.com>2019-03-28 08:08:35 -0700
commit6fd3c852b15820480ad2ea83e7857615c4976304 (patch)
treea35354dbc7dd7ae0ac34ac439d10de3b0b060811
parent374663567935f0c8350982398b5cd28520c75713 (diff)
downloadcpython-git-6fd3c852b15820480ad2ea83e7857615c4976304.tar.gz
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. (cherry picked from commit cda139d1ded6708665b53e4ed32ccc1d2627e1da) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
-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 0000000000..6c234a6a76
--- /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 34722f85b9..e374c5a4ae 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1055,7 +1055,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;