Close connection when SSH handshake fails.

This commit is contained in:
NI
2019-09-02 12:37:51 +08:00
parent 5a8d369224
commit b1cd29cc27

View File

@@ -419,6 +419,8 @@ func (d *sshClient) dialRemote(
c, chans, reqs, err := ssh.NewClientConn(&sshConn, addr, config) c, chans, reqs, err := ssh.NewClientConn(&sshConn, addr, config)
if err != nil { if err != nil {
sshConn.Close()
return nil, nil, err return nil, nil, err
} }