Skip to content

Commit 9e4c763

Browse files
committed
Ensure dispose of enumerators in EqualityComparer
1 parent b82e705 commit 9e4c763

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Shouldly/Internals/EqualityComparer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public bool Equals(T? x, T? y)
3838
y.TryGetEnumerable(out var enumerableY))
3939
{
4040
var enumeratorX = enumerableX.GetEnumerator();
41+
using var enumeratorXDispose = enumeratorX as IDisposable;
4142
var enumeratorY = enumerableY.GetEnumerator();
43+
using var enumeratorYDispose = enumeratorY as IDisposable;
4244
var equalityComparer = _innerComparerFactory();
4345

4446
while (true)

0 commit comments

Comments
 (0)