Add missing ch.Close() on premature error

This commit is contained in:
Manfred Touron 2018-01-02 05:53:40 +01:00
parent 7ea7237d19
commit 1b52673603

2
ssh.go
View file

@ -108,6 +108,7 @@ func channelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
}
fmt.Fprintf(ch, "error: %v\n", err)
// FIXME: force close all channels
_ = ch.Close()
return
}
@ -122,6 +123,7 @@ func channelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
return
}
fmt.Fprintf(ch, "error: %v\n", err)
_ = ch.Close()
return
}