[Python-checkins] bpo-39307: Fix memory leak on error path in parsetok (GH-17953)

Miss Islington (bot) webhook-mailer at python.org
Mon Jan 13 05:54:28 EST 2020


https://github.com/python/cpython/commit/9671b6b3b3e480fbc4b14aab7008b90b38767f55
commit: 9671b6b3b3e480fbc4b14aab7008b90b38767f55
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-01-13T02:54:24-08:00
summary:

bpo-39307: Fix memory leak on error path in parsetok (GH-17953)

(cherry picked from commit 7ba6f18de2582755ae31888ba6a4237d96dddc48)

Co-authored-by: Alex Henrie <alexhenrie24 at gmail.com>

files:
M Parser/parsetok.c

diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index a5d78974b871b..2bb733d0dcd66 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -246,6 +246,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
 
     if ((ps = PyParser_New(g, start)) == NULL) {
         err_ret->error = E_NOMEM;
+        growable_comment_array_deallocate(&type_ignores);
         PyTokenizer_Free(tok);
         return NULL;
     }



More information about the Python-checkins mailing list