]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 28 Mar 2019 15:08:35 +0000 (08:08 -0700)
committerGitHub <noreply@github.com>
Thu, 28 Mar 2019 15:08:35 +0000 (08:08 -0700)
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>
Misc/NEWS.d/next/Core and Builtins/2019-03-27-22-35-16.bpo-36459.UAvkKp.rst [new file with mode: 0644]
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 (file)
index 0000000..6c234a6
--- /dev/null
@@ -0,0 +1 @@
+Fix a possible double ``PyMem_FREE()`` due to tokenizer.c's ``tok_nextc()``.
index 34722f85b94a558d2826b00ada142cf5d8a475f3..e374c5a4aee615bd8bd7653b35bcf0f1b21c61d0 100644 (file)
@@ -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;