summaryrefslogtreecommitdiffstats
path: root/Parser/parser.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1990-11-18 17:38:42 (GMT)
committerGuido van Rossum <guido@python.org>1990-11-18 17:38:42 (GMT)
commit99f02d43f3d8d771b9e1b4784a72937bffff5647 (patch)
treeb4f38b847ca8aa6f922445b59f442bd6f763cb8a /Parser/parser.c
parentf1270274e262bc080a2c3d2dd500988d6d80159a (diff)
downloadcpython-99f02d43f3d8d771b9e1b4784a72937bffff5647.zip
cpython-99f02d43f3d8d771b9e1b4784a72937bffff5647.tar.gz
cpython-99f02d43f3d8d771b9e1b4784a72937bffff5647.tar.bz2
Free parse tree when deleting parser.
Diffstat (limited to 'Parser/parser.c')
-rw-r--r--Parser/parser.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Parser/parser.c b/Parser/parser.c
index e0b3530..294c534 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -96,8 +96,6 @@ newparser(g, start)
ps->p_grammar = g;
ps->p_tree = newnode(start);
if (ps->p_tree == NULL) {
- if (ps->p_tree != NULL)
- DEL(ps->p_tree); /* XXX freeing a node!?! */
DEL(ps);
return NULL;
}
@@ -110,6 +108,9 @@ void
delparser(ps)
parser_state *ps;
{
+ /* NB If you want to save the parse tree,
+ you must set p_tree to NULL before calling delparser! */
+ freenode(ps->p_tree);
DEL(ps);
}