diff --git a/infer/src/dotnet/ResourceLeakCSDomain.ml b/infer/src/dotnet/ResourceLeakCSDomain.ml index 5c41df7c6..e9d7dc4ac 100644 --- a/infer/src/dotnet/ResourceLeakCSDomain.ml +++ b/infer/src/dotnet/ResourceLeakCSDomain.ml @@ -97,7 +97,9 @@ let release_resource access_path held = let old_count = find_count access_path held in let remove_resource_from_hash = match old_count with - | NonTop count when count < 2 -> + | Top -> + Hashtbl.remove !type_map access_path + | NonTop count when count <= 0 -> Hashtbl.remove !type_map access_path | _ -> ()