Skip to content

Commit

Permalink
Merge pull request #154 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…51-to-release-4.6

[release-4.6] Bug 1941563: Ensure response body is closed when we are finished with the request
  • Loading branch information
openshift-merge-robot committed Mar 24, 2021
2 parents 4480c4f + 9184618 commit 9b15b11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/termination/termination.go
Expand Up @@ -107,6 +107,9 @@ func (h *handler) run(ctx context.Context) error {
req.Header.Add("Metadata-Flavor", "Google")

resp, err := http.DefaultClient.Do(req)
if resp != nil {
defer resp.Body.Close()
}
if err != nil {
return false, fmt.Errorf("could not get URL %q: %w", h.pollURL.String(), err)
}
Expand Down

0 comments on commit 9b15b11

Please sign in to comment.