[Python-checkins] Fix possible refleak involving _PyArena_AddPyObject (GH-25289)
pablogsal
webhook-mailer at python.org
Thu Apr 8 19:05:52 EDT 2021
https://github.com/python/cpython/commit/c0e11a3ceb9427e09db4224f394c7789bf6deec5
commit: c0e11a3ceb9427e09db4224f394c7789bf6deec5
branch: master
author: Erlend Egeberg Aasland <erlend.aasland at innova.no>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-04-09T00:05:44+01:00
summary:
Fix possible refleak involving _PyArena_AddPyObject (GH-25289)
files:
M Parser/pegen.c
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 82dcd3bb5a858..7b5a5e9146857 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -690,7 +690,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