From 9f65e89760132b3a5ef07768df8cf872dac0c62d Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 3 Nov 2025 14:24:39 +0000 Subject: [PATCH] fix: close resp body (bodyclose) Signed-off-by: Babak K. Shandiz --- api/queries_repo.go | 2 ++ pkg/cmd/repo/edit/edit.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/api/queries_repo.go b/api/queries_repo.go index e797cead4..4dadcbad3 100644 --- a/api/queries_repo.go +++ b/api/queries_repo.go @@ -1549,6 +1549,8 @@ func RepoExists(client *Client, repo ghrepo.Interface) (bool, error) { return false, err } + defer resp.Body.Close() + switch resp.StatusCode { case 200: return true, nil diff --git a/pkg/cmd/repo/edit/edit.go b/pkg/cmd/repo/edit/edit.go index 94ad8868a..68c71c80f 100644 --- a/pkg/cmd/repo/edit/edit.go +++ b/pkg/cmd/repo/edit/edit.go @@ -526,6 +526,8 @@ func getTopics(ctx context.Context, httpClient *http.Client, repo ghrepo.Interfa if err != nil { return nil, err } + defer res.Body.Close() + if res.StatusCode != http.StatusOK { return nil, api.HandleHTTPError(res) } @@ -563,6 +565,7 @@ func setTopics(ctx context.Context, httpClient *http.Client, repo ghrepo.Interfa if err != nil { return err } + defer res.Body.Close() if res.StatusCode != http.StatusOK { return api.HandleHTTPError(res)