[Python-checkins] [3.9] bpo-43779: Fix possible refleak involving _PyArena_AddPyObject (GH-25289). (GH-25294)
pablogsal
webhook-mailer at python.org
Fri Apr 9 13:46:41 EDT 2021
https://github.com/python/cpython/commit/76d270ec2b776cc5331935cc58c2d63622f1c0e9
commit: 76d270ec2b776cc5331935cc58c2d63622f1c0e9
branch: 3.9
author: Erlend Egeberg Aasland <erlend.aasland at innova.no>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-04-09T18:46:32+01:00
summary:
[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 at innova.no>
* Update Parser/pegen/pegen.c
Co-authored-by: Pablo Galindo <Pablogsal at gmail.com>
files:
M Parser/pegen/pegen.c
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c
index 0a26275b23e0d..111009af63e22 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;
More information about the Python-checkins
mailing list