diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-06-06 00:10:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-06 00:10:57 (GMT) |
commit | 79e6c15aed9b4b50efd39ddaf1dc40c374b51213 (patch) | |
tree | 94fbad52f96b6651b95bbc54edd25eb8467518f7 /Parser | |
parent | a4fa9a95153a3800dea60b3029b2dcaf8a4f6acb (diff) | |
download | cpython-79e6c15aed9b4b50efd39ddaf1dc40c374b51213.zip cpython-79e6c15aed9b4b50efd39ddaf1dc40c374b51213.tar.gz cpython-79e6c15aed9b4b50efd39ddaf1dc40c374b51213.tar.bz2 |
bpo-40883: Fix memory leak in fstring_compile_expr in parse_string.c (GH-20667)
(cherry picked from commit a54096e30523534e8eebb8dc1011b4536ed237a8)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/pegen/parse_string.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Parser/pegen/parse_string.c b/Parser/pegen/parse_string.c index e24ecc5..efe82df 100644 --- a/Parser/pegen/parse_string.c +++ b/Parser/pegen/parse_string.c @@ -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); @@ -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; |