PooledConnectionHandle object leaked when LoginAsync throws an exception in PerforceService.cs:ConnectAsync

Set up Horde Server locally, put incorrect Perforce password, set a breakpoint after `handle.LoginAsync(credentials.Password, cancellationToken);`

After LoginAsync fails, the handle is never returned to the caller, therefore never properly disposed.

I’ve attached proposed fix as an image.

[Attachment Removed]

Steps to Reproduce
Set up Horde Server locally, put incorrect Perforce password, set a breakpoint after `handle.LoginAsync(credentials.Password, cancellationToken);`

After LoginAsync fails, the handle is never returned to the caller, therefore never properly disposed.

[Attachment Removed]

Hello Sabrina, we have recently submitted a similar fix for this issue.

Thank you for bringing it our attention and sending a patch.

Matthew

[Attachment Removed]