mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-13 13:52:01 +00:00
kubectl: fix memory leaks in port forwarding client
Signed-off-by: LiHui <andrewli@kubesphere.io> Kubernetes-commit: 1df24569a0bf62a528c49f73fdb236fd56eb05ee
This commit is contained in:
committed by
Kubernetes Publisher
parent
f6b8521807
commit
cc3cc93e6a
@@ -347,6 +347,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) {
|
||||
}
|
||||
// we're not writing to this stream
|
||||
errorStream.Close()
|
||||
defer pf.streamConn.RemoveStreams(errorStream)
|
||||
|
||||
errorChan := make(chan error)
|
||||
go func() {
|
||||
@@ -367,6 +368,7 @@ func (pf *PortForwarder) handleConnection(conn net.Conn, port ForwardedPort) {
|
||||
runtime.HandleError(fmt.Errorf("error creating forwarding stream for port %d -> %d: %v", port.Local, port.Remote, err))
|
||||
return
|
||||
}
|
||||
defer pf.streamConn.RemoveStreams(dataStream)
|
||||
|
||||
localError := make(chan struct{})
|
||||
remoteDone := make(chan struct{})
|
||||
|
Reference in New Issue
Block a user