From: Tom Clegg Date: Thu, 14 Jul 2022 04:58:15 +0000 (-0400) Subject: 17344: Fix unclosed response body. X-Git-Tag: 2.5.0~115^2~9 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/4a9acc11eaba55a152851256d19c8fdad3b9f863 17344: Fix unclosed response body. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/lib/install/init.go b/lib/install/init.go index a341155ab3..b48edcd4a5 100644 --- a/lib/install/init.go +++ b/lib/install/init.go @@ -494,6 +494,9 @@ func (initcmd *initCommand) checkPortOnce(ctx context.Context, port string) erro return err } resp, err := http.DefaultClient.Do(req) + if err == nil { + defer resp.Body.Close() + } if errServe, _ := errServe.Load().(error); errServe != nil { // If server already exited, return that error // (probably "can't listen"), not the request error.