[issue35973] `growable_int_array type_ignores` in parsetok.c is not always freed.
Guido van Rossum
report at bugs.python.org
Tue Feb 12 00:36:43 EST 2019
Guido van Rossum <guido at python.org> added the comment:
Thanks for the report!
I think I see a path through the code that doesn't free the memory.
Does this patch fix it?
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 1fa4a1286b..6a96f6bc5a 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
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35973>
_______________________________________
More information about the Python-bugs-list
mailing list