]> granicus.if.org Git - python/commitdiff
Fix potential memory leak in parsetok.c (GH-11832)
authorPablo Galindo <Pablogsal@gmail.com>
Wed, 13 Feb 2019 00:45:53 +0000 (00:45 +0000)
committerGitHub <noreply@github.com>
Wed, 13 Feb 2019 00:45:53 +0000 (00:45 +0000)
Parser/parsetok.c

index 1fa4a1286b775dd64dff32388b2a0bbe978f031a..6a96f6bc5a57fba61614c557e428280a0e50778a 100644 (file)
@@ -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