[Python-checkins] bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
Miss Islington (bot)
webhook-mailer at python.org
Thu Mar 28 10:44:26 EDT 2019
https://github.com/python/cpython/commit/dffe90ee0eaf77785ad3d4ad7fb3249430ed1cb9
commit: dffe90ee0eaf77785ad3d4ad7fb3249430ed1cb9
branch: 2.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-03-28T07:44:21-07:00
summary:
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 at gmail.com>
files:
A Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst
M Parser/tokenizer.c
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 000000000000..6c234a6a76d9
--- /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 6d7869c88e22..89666611940c 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -979,7 +979,6 @@ tok_nextc(register 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;
More information about the Python-checkins
mailing list