From d65bdec20c930a3188d8e0619f861481dabe02ee Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Wed, 23 Sep 2026 02:44:12 -0300 Subject: scan possily leaks its transaction before its first fetch --- lib/kernel/SubstantialRelation.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kernel/SubstantialRelation.ml') 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. *) -- cgit v1.2.3