mirror of
https://github.com/moul/sshportal.git
synced 2025-09-07 13:14:49 +08:00
Add missing ch.Close() on premature error
This commit is contained in:
parent
7ea7237d19
commit
1b52673603
1 changed files with 2 additions and 0 deletions
2
ssh.go
2
ssh.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue