From 8598dd3c523ed873cddd80952d4e26188722421e Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sat, 6 Jun 2020 00:18:22 +0100 Subject: [PATCH 1/2] bpo-40883: Fix memory leak in fstring_compile_expr in parse_string.c --- Parser/pegen/parse_string.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Parser/pegen/parse_string.c b/Parser/pegen/parse_string.c index e24ecc58d3aa1dc..efe82df47658bdb 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; From 4eed734cf4df99bff47e445c0b45e99b8d5fb54f Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2020 23:25:04 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core and Builtins/2020-06-05-23-25-00.bpo-40883.M6sQ-Q.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-06-05-23-25-00.bpo-40883.M6sQ-Q.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-05-23-25-00.bpo-40883.M6sQ-Q.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-05-23-25-00.bpo-40883.M6sQ-Q.rst new file mode 100644 index 000000000000000..ebeb0cc60d16bb4 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-05-23-25-00.bpo-40883.M6sQ-Q.rst @@ -0,0 +1 @@ +Fix memory leak in when parsing f-strings in the new parser. Patch by Pablo Galindo \ No newline at end of file