summaryrefslogtreecommitdiff
path: root/src/error_format.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-01-03 18:14:50 +0000
committerAlasdair Armstrong2019-01-03 18:14:50 +0000
commit3225079cfe3250465c97ca7308d45d1f09cf07f8 (patch)
treef56609fd763cbaaa1e7a73ea4fff061b18962b76 /src/error_format.ml
parentdfbbb4f111082008f26c34986244222d4c869e25 (diff)
Make sure to close file handles when printing error messages
Diffstat (limited to 'src/error_format.ml')
-rw-r--r--src/error_format.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/error_format.ml b/src/error_format.ml
index 9e125efa..f152f0ae 100644
--- a/src/error_format.ml
+++ b/src/error_format.ml
@@ -72,7 +72,7 @@ let format_code_single fname lnum cnum_from cnum_to contents ppf =
try
let in_chan = open_in fname in
begin
- try format_code_single' fname in_chan lnum cnum_from cnum_to contents ppf
+ try format_code_single' fname in_chan lnum cnum_from cnum_to contents ppf; close_in in_chan
with
| _ -> close_in_noerr in_chan; ()
end
@@ -83,7 +83,7 @@ let format_code_double fname lnum_from cnum_from lnum_to cnum_to contents ppf =
try
let in_chan = open_in fname in
begin
- try format_code_double' fname in_chan lnum_from cnum_from lnum_to cnum_to contents ppf
+ try format_code_double' fname in_chan lnum_from cnum_from lnum_to cnum_to contents ppf; close_in in_chan
with
| _ -> close_in_noerr in_chan; ()
end