summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-04-15 20:03:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-04-15 20:03:56 -0700
commitf200086eff39c729cbdbb5dbdcb97b134f3fdd0d (patch)
tree66d1853e84c8ed28a6fff176eb401db8cb6d5372 /txr.c
parent50b5651649f71c7f1e4c480504b61cea04d8f789 (diff)
downloadtxr-f200086eff39c729cbdbb5dbdcb97b134f3fdd0d.tar.gz
txr-f200086eff39c729cbdbb5dbdcb97b134f3fdd0d.tar.bz2
txr-f200086eff39c729cbdbb5dbdcb97b134f3fdd0d.zip
Close source files after parsing.
* eval.c (sys_load): close stream in all cases. * match.c (v_load): Likewise. * parser.c (load_rcfile): Close stream in unwind block, if open. * txr.c (txr_main): Close stream after parsing in all cases. If stream is std_input, or a string stream, close_stream does nothing.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/txr.c b/txr.c
index d9c2b166..def35cc9 100644
--- a/txr.c
+++ b/txr.c
@@ -831,6 +831,8 @@ int txr_main(int argc, char **argv)
parse_once(parse_stream, spec_file_str, &parser);
gc_state(gc);
+ close_stream(parse_stream, nil);
+
if (parser.errors)
return EXIT_FAILURE;
@@ -861,6 +863,8 @@ int txr_main(int argc, char **argv)
{
val result = read_eval_stream(parse_stream, std_error, t);
+ close_stream(parse_stream, nil);
+
if (!enter_repl)
return result ? 0 : EXIT_FAILURE;
}