From f200086eff39c729cbdbb5dbdcb97b134f3fdd0d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 15 Apr 2016 20:03:56 -0700 Subject: 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. --- txr.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'txr.c') 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; } -- cgit v1.2.3