From 98ee1adb13e4962cfe40aaa8fa2048d099e0b2b3 Mon Sep 17 00:00:00 2001 From: cui Date: Sun, 29 Mar 2026 23:16:00 +0800 Subject: [PATCH] client: close TCP connection when fmux session creation fails (#5262) If realConnect() succeeds but fmux.Client returns an error, the connection was not assigned to the connector and would leak. --- client/connector.go | 1 + 1 file changed, 1 insertion(+) diff --git a/client/connector.go b/client/connector.go index 03d7fc29..51536750 100644 --- a/client/connector.go +++ b/client/connector.go @@ -119,6 +119,7 @@ func (c *defaultConnectorImpl) Open() error { fmuxCfg.MaxStreamWindowSize = 6 * 1024 * 1024 session, err := fmux.Client(conn, fmuxCfg) if err != nil { + conn.Close() return err } c.muxSession = session