From 321ceaa0dabff2e119e3c96f1e84e9c2e8e52914 Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Fri, 16 May 2014 15:42:11 -0400 Subject: [PATCH] Response body must not be closed if request error'd. --- initialize/ssh_keys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initialize/ssh_keys.go b/initialize/ssh_keys.go index 4e998d0..954e1a9 100644 --- a/initialize/ssh_keys.go +++ b/initialize/ssh_keys.go @@ -26,10 +26,10 @@ func SSHImportKeysFromURL(system_user string, url string) error { func fetchUserKeys(url string) ([]string, error) { res, err := http.Get(url) - defer res.Body.Close() if err != nil { return nil, err } + defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err