mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
gh-95355: Check tokens[0] after allocating memory (GH-95356)
#95355 Automerge-Triggered-By: GH:pablogsal
This commit is contained in:
parent
e16d4ed590
commit
b946f529ef
2 changed files with 2 additions and 1 deletions
|
@ -738,7 +738,7 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags,
|
|||
return (Parser *) PyErr_NoMemory();
|
||||
}
|
||||
p->tokens[0] = PyMem_Calloc(1, sizeof(Token));
|
||||
if (!p->tokens) {
|
||||
if (!p->tokens[0]) {
|
||||
PyMem_Free(p->tokens);
|
||||
PyMem_Free(p);
|
||||
return (Parser *) PyErr_NoMemory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue