Skip to content

Commit 97ed0dd

Browse files
committed
Dereference socket instance field before disposing it.
1 parent 3e01002 commit 97ed0dd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Renci.SshNet/Channels/ChannelDirectTcpip.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,11 @@ protected override void Dispose(bool disposing)
263263
{
264264
lock (_socketLock)
265265
{
266-
if (_socket != null)
266+
var socket = _socket;
267+
if (socket != null)
267268
{
268-
_socket.Dispose();
269269
_socket = null;
270+
socket.Dispose();
270271
}
271272
}
272273
}

0 commit comments

Comments
 (0)