From b1a1a900454b6ea9a998541c80df05c83938f3df Mon Sep 17 00:00:00 2001 From: ardevd Date: Mon, 9 Jun 2025 22:10:17 +0200 Subject: [PATCH] chore(syncthing): ensure response body is closed in upgrade request (#10169) --- cmd/syncthing/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 47cf7702f..9f60f70ce 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -403,9 +403,11 @@ func upgradeViaRest() error { if err != nil { return err } + + defer resp.Body.Close() + if resp.StatusCode != 200 { bs, err := io.ReadAll(resp.Body) - defer resp.Body.Close() if err != nil { return err }