aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-07-21 13:03:36 +0200
committerGitHub <noreply@github.com>2022-07-21 13:03:36 +0200
commit712267ee20b7cf4a8bbd73a4f13608f48ffe962b (patch)
tree5bf80dcd0bc22cbd426544c35af54ddc9867e29f /pkg
parent0de7e4662e6d574fe382714cb6664a4519771f88 (diff)
parenta652659429850150c8447cf759e478f37529a84f (diff)
downloadpodman-712267ee20b7cf4a8bbd73a4f13608f48ffe962b.tar.gz
podman-712267ee20b7cf4a8bbd73a4f13608f48ffe962b.tar.bz2
podman-712267ee20b7cf4a8bbd73a4f13608f48ffe962b.zip
Merge pull request #14980 from n1hility/fix-leak
Fix potential body leak on mid-stream read error when fetching artifact version
Diffstat (limited to 'pkg')
-rw-r--r--pkg/machine/fedora.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/machine/fedora.go b/pkg/machine/fedora.go
index 7ac4692e3..497265269 100644
--- a/pkg/machine/fedora.go
+++ b/pkg/machine/fedora.go
@@ -105,11 +105,11 @@ func getFedoraDownload(releaseURL string) (*url.URL, string, int64, error) {
return nil, "", -1, fmt.Errorf("get request failed: %s: %w", verURL.String(), err)
}
+ defer resp.Body.Close()
bytes, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 1024})
if err != nil {
return nil, "", -1, fmt.Errorf("failed reading: %s: %w", verURL.String(), err)
}
- _ = resp.Body.Close()
return downloadURL, strings.TrimSpace(string(bytes)), contentLen, nil
}