From 3225079cfe3250465c97ca7308d45d1f09cf07f8 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 3 Jan 2019 18:14:50 +0000 Subject: Make sure to close file handles when printing error messages --- src/error_format.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/error_format.ml') 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 -- cgit v1.2.3