[Python-checkins] Fix potential memory leak in parsetok.c (GH-11832)

Pablo Galindo webhook-mailer at python.org
Tue Feb 12 19:45:56 EST 2019


https://github.com/python/cpython/commit/b9d2e97601847a1845bf96e2895a6214f02b92a6
commit: b9d2e97601847a1845bf96e2895a6214f02b92a6
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-02-13T00:45:53Z
summary:

Fix potential memory leak in parsetok.c (GH-11832)

files:
M Parser/parsetok.c

diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 1fa4a1286b77..6a96f6bc5a57 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -370,7 +370,6 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
                                 type_ignores.items[i], 0);
             }
         }
-        growable_int_array_deallocate(&type_ignores);
 
 #ifndef PGEN
         /* Check that the source for a single input statement really
@@ -405,6 +404,8 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
     else
         n = NULL;
 
+    growable_int_array_deallocate(&type_ignores);
+
 #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
     *flags = ps->p_flags;
 #endif



More information about the Python-checkins mailing list