]> granicus.if.org Git - python/commitdiff
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
authorZackery Spytz <zspytz@gmail.com>
Thu, 28 Mar 2019 13:53:00 +0000 (07:53 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 28 Mar 2019 13:53:00 +0000 (15:53 +0200)
Remove the PyMem_FREE() call added in cb90c89.  The buffer will be
freed when PyTokenizer_Free() is called on the tokenizer state.

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 ad054975689ee1a04fd5ed1b6f2cf660b1f0290e..58dd1cd30b37b94b728fd7a71c6568a37373418a 100644 (file)
@@ -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;