diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-04-09 17:46:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 17:46:32 (GMT) |
commit | 76d270ec2b776cc5331935cc58c2d63622f1c0e9 (patch) | |
tree | 83e5b7d31b2e4f3e53f2b8b8c113cf24429fce61 /Parser | |
parent | 299ae9c7a2a169d54921815b9bb41a8f9277a3aa (diff) | |
download | cpython-76d270ec2b776cc5331935cc58c2d63622f1c0e9.zip cpython-76d270ec2b776cc5331935cc58c2d63622f1c0e9.tar.gz cpython-76d270ec2b776cc5331935cc58c2d63622f1c0e9.tar.bz2 |
[3.9] bpo-43779: Fix possible refleak involving _PyArena_AddPyObject (GH-25289). (GH-25294)
* [3.9] Fix possible refleak involving _PyArena_AddPyObject (GH-25289).
(cherry picked from commit c0e11a3ceb9427e09db4224f394c7789bf6deec5)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* Update Parser/pegen/pegen.c
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/pegen/pegen.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index 0a26275..111009a 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -639,7 +639,10 @@ _PyPegen_fill_token(Parser *p) if (t->bytes == NULL) { return -1; } - PyArena_AddPyObject(p->arena, t->bytes); + if (PyArena_AddPyObject(p->arena, t->bytes) < 0) { + Py_DECREF(t->bytes); + return -1; + } int lineno = type == STRING ? p->tok->first_lineno : p->tok->lineno; const char *line_start = type == STRING ? p->tok->multi_line_start : p->tok->line_start; |