]> granicus.if.org Git - python/commitdiff
Finally plug the memory leak caused by syntax error (including
authorGuido van Rossum <guido@python.org>
Sun, 27 Jul 1997 01:52:50 +0000 (01:52 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 27 Jul 1997 01:52:50 +0000 (01:52 +0000)
interactive EOF, which leaked *one* byte).

Parser/parsetok.c

index 251e5074dda78da4f467cecf219faabab9e9fa7d..93df0d69d0e42a78cb8bbf9482dd1567d8ce6fe0 100644 (file)
@@ -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) {