From cc384733baabade82351242bffb1aef95ecaaecc Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 28 Apr 2020 16:14:45 +0200 Subject: [PATCH 1/2] add missing http body Close() in Client.GetLookup() --- internal/source/gitlab/client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index afe9da6f8..6d2fa28c5 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -88,9 +88,13 @@ func (gc *Client) GetLookup(ctx context.Context, host string) api.Lookup { lookup := api.Lookup{Name: host} lookup.Error = json.NewDecoder(resp.Body).Decode(&lookup.Domain) + resp.Body.Close() + return lookup } +// get returns the response object +// the caller is responsible for closing the response body func (gc *Client) get(ctx context.Context, path string, params url.Values) (*http.Response, error) { endpoint, err := gc.endpoint(path, params) if err != nil { -- GitLab From 8c0a603de13a0fafd1648759bce91540eeb0fa92 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 28 Apr 2020 17:20:59 +0200 Subject: [PATCH 2/2] add resp.Body.Close() in Artifacts while we are at it --- internal/artifact/artifact.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/artifact/artifact.go b/internal/artifact/artifact.go index 91ecbcf89..9677b21c1 100644 --- a/internal/artifact/artifact.go +++ b/internal/artifact/artifact.go @@ -96,6 +96,8 @@ func (a *Artifact) makeRequest(w http.ResponseWriter, r *http.Request, reqURL *u return } + defer resp.Body.Close() + if additionalHandler(resp) { return } -- GitLab