Explorar o código

Dereference socket instance field before disposing it.

drieseng %!s(int64=9) %!d(string=hai) anos
pai
achega
97ed0ddb1c
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      src/Renci.SshNet/Channels/ChannelDirectTcpip.cs

+ 3 - 2
src/Renci.SshNet/Channels/ChannelDirectTcpip.cs

@@ -263,10 +263,11 @@ namespace Renci.SshNet.Channels
                 {
                     lock (_socketLock)
                     {
-                        if (_socket != null)
+                        var socket = _socket;
+                        if (socket != null)
                         {
-                            _socket.Dispose();
                             _socket = null;
+                            socket.Dispose();
                         }
                     }
                 }