From: Guido van Rossum Date: Sun, 27 Jul 1997 01:52:50 +0000 (+0000) Subject: Finally plug the memory leak caused by syntax error (including X-Git-Tag: v1.5a3~172 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff0ec52d3c60b1a7656cb8bab53e9ba1dd5b773b;p=python Finally plug the memory leak caused by syntax error (including interactive EOF, which leaked *one* byte). --- diff --git a/Parser/parsetok.c b/Parser/parsetok.c index 251e5074dd..93df0d69d0 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) {