summaryrefslogtreecommitdiffstats
path: root/Parser/parsetok.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-07-27 01:52:50 (GMT)
committerGuido van Rossum <guido@python.org>1997-07-27 01:52:50 (GMT)
commitff0ec52d3c60b1a7656cb8bab53e9ba1dd5b773b (patch)
tree34dfbf4fea46f5380ae3b8111065ea7edc0e3e7e /Parser/parsetok.c
parent6fc06e770fc8a4338a331e05f4ea85e01fc039fa (diff)
downloadcpython-ff0ec52d3c60b1a7656cb8bab53e9ba1dd5b773b.zip
cpython-ff0ec52d3c60b1a7656cb8bab53e9ba1dd5b773b.tar.gz
cpython-ff0ec52d3c60b1a7656cb8bab53e9ba1dd5b773b.tar.bz2
Finally plug the memory leak caused by syntax error (including
interactive EOF, which leaked *one* byte).
Diffstat (limited to 'Parser/parsetok.c')
-rw-r--r--Parser/parsetok.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 251e507..93df0d6 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -154,8 +154,11 @@ parsetok(tok, g, start, err_ret)
str[len] = '\0';
if ((err_ret->error =
PyParser_AddToken(ps, (int)type, str,
- tok->lineno)) != E_OK)
+ tok->lineno)) != E_OK) {
+ if (err_ret->error != E_DONE)
+ PyMem_DEL(str);
break;
+ }
}
if (err_ret->error == E_DONE) {