Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff0ec52

Browse files
committed
Finally plug the memory leak caused by syntax error (including
interactive EOF, which leaked *one* byte).
1 parent 6fc06e7 commit ff0ec52

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Parser/parsetok.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ parsetok(tok, g, start, err_ret)
154154
str[len] = '\0';
155155
if ((err_ret->error =
156156
PyParser_AddToken(ps, (int)type, str,
157-
tok->lineno)) != E_OK)
157+
tok->lineno)) != E_OK) {
158+
if (err_ret->error != E_DONE)
159+
PyMem_DEL(str);
158160
break;
161+
}
159162
}
160163

161164
if (err_ret->error == E_DONE) {

0 commit comments

Comments
 (0)