From 9ace223794aa203b4c877d08a1f7bf2f595f6242 Mon Sep 17 00:00:00 2001 From: "Nicholas S. Husin" Date: Tue, 6 Jan 2026 16:45:22 -0500 Subject: [PATCH] websocket: add missing call to resp.Body.Close Within hybiClientHandshake, after getting a response from http.ReadResponse, the body is never closed. When running a debugger with all of our test cases, this seems to not matter usually since the body is typically a http.noBody, whose Close just returns nil. However, this is not always the case. Therefore, this CL adds the missing resp.Body.Close call. Fixes golang/go#76952 Change-Id: I292d6ccc8eb101b806738aa7fc3e5446b623d861 Reviewed-on: https://go-review.googlesource.com/c/net/+/734240 Reviewed-by: Damien Neil LUCI-TryBot-Result: Go LUCI Reviewed-by: Nicholas Husin --- websocket/hybi.go | 1 + 1 file changed, 1 insertion(+) diff --git a/websocket/hybi.go b/websocket/hybi.go index dda74346..c7e76cd9 100644 --- a/websocket/hybi.go +++ b/websocket/hybi.go @@ -440,6 +440,7 @@ func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (er if err != nil { return err } + defer resp.Body.Close() if resp.StatusCode != 101 { return ErrBadStatus }