Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set p->size when memory allocation for a Token fails
  • Loading branch information
lysnikolaou committed Apr 23, 2020
commit cb42515360bbc13ec914f95b153b9d1bb41b3255
1 change: 1 addition & 0 deletions Parser/pegen/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ _PyPegen_fill_token(Parser *p)
for (int i = p->size; i < newsize; i++) {
p->tokens[i] = PyMem_Malloc(sizeof(Token));
if (p->tokens[i] == NULL) {
Comment thread
lysnikolaou marked this conversation as resolved.
p->size = i - 1; // Needed, in order to cleanup correctly after parser fails
Comment thread
lysnikolaou marked this conversation as resolved.
Outdated
PyErr_NoMemory();
return -1;
}
Expand Down