aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/SubstantialRelation.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/SubstantialRelation.ml')
-rw-r--r--lib/kernel/SubstantialRelation.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kernel/SubstantialRelation.ml b/lib/kernel/SubstantialRelation.ml
index d3f306b..ec2a01f 100644
--- a/lib/kernel/SubstantialRelation.ml
+++ b/lib/kernel/SubstantialRelation.ml
@@ -131,9 +131,9 @@ module Make (S : Abstract.Storage.STORAGE) = struct
let scan storage relation ~keep =
let open Utilities.Result in
let* tx = S.start_read storage in
- let* node = tuple_node tx relation in
let closed = ref false in
let close () = if not !closed then begin closed := true; ignore (S.abort tx) end in
+ let* node = tuple_node tx relation |> Result.map_error (fun c -> close (); c) in
(* The fold is suspended by [yield], so the tree is walked one node
and one tuple at a time rather than materialized before the
first tuple is produced. *)