Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix memory leak in when parsing f-strings in the new parser. Patch by Pablo Galindo
2 changes: 2 additions & 0 deletions Parser/pegen/parse_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ fstring_compile_expr(Parser *p, const char *expr_start, const char *expr_end,

struct tok_state* tok = PyTokenizer_FromString(str, 1);
if (tok == NULL) {
PyMem_RawFree(str);
return NULL;
}
Py_INCREF(p->tok->filename);
Expand All @@ -629,6 +630,7 @@ fstring_compile_expr(Parser *p, const char *expr_start, const char *expr_end,
result = expr;

exit:
PyMem_RawFree(str);
_PyPegen_Parser_Free(p2);
PyTokenizer_Free(tok);
return result;
Expand Down