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 cda139d1de)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-03-28 07:44:21 -07:00 committed by GitHub
parent bb89aa24cf
commit dffe90ee0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix a possible double ``PyMem_FREE()`` due to tokenizer.c's ``tok_nextc()``.

View File

@ -979,7 +979,6 @@ tok_nextc(register struct tok_state *tok)
newbuf = (char *)PyMem_REALLOC(newbuf, newbuf = (char *)PyMem_REALLOC(newbuf,
newsize); newsize);
if (newbuf == NULL) { if (newbuf == NULL) {
PyMem_FREE(tok->buf);
tok->done = E_NOMEM; tok->done = E_NOMEM;
tok->cur = tok->inp; tok->cur = tok->inp;
return EOF; return EOF;