summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--tools/ocamldep.ml13
2 files changed, 11 insertions, 3 deletions
diff --git a/Changes b/Changes
index cf1d68f3d..06470ecfc 100644
--- a/Changes
+++ b/Changes
@@ -109,6 +109,7 @@ Bug fixes:
- PR#5906: GADT exhaustiveness check is still broken
- PR#5907: Undetected cycle during typecheck causes exceptions
- PR#5911: Signature substitutions fail in submodules
+- PR#5930: ocamldep leaks temporary preprocessing files
OCaml 4.00.1:
-------------
diff --git a/tools/ocamldep.ml b/tools/ocamldep.ml
index 1bafbc678..1b958db23 100644
--- a/tools/ocamldep.ml
+++ b/tools/ocamldep.ml
@@ -207,9 +207,16 @@ let read_parse_and_extract parse_function extract_function magic source_file =
Depend.free_structure_names := Depend.StringSet.empty;
try
let input_file = Pparse.preprocess source_file in
- let ast = Pparse.file Format.err_formatter input_file parse_function magic in
- extract_function Depend.StringSet.empty ast;
- !Depend.free_structure_names
+ begin try
+ let ast =
+ Pparse.file Format.err_formatter input_file parse_function magic in
+ extract_function Depend.StringSet.empty ast;
+ Pparse.remove_preprocessed input_file;
+ !Depend.free_structure_names
+ with x ->
+ Pparse.remove_preprocessed_if_ast input_file;
+ raise x
+ end
with x ->
report_err source_file x;
Depend.StringSet.empty