From 3480c88e904c6234309ed20c88aff7d0a684e87f Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 7 Feb 2018 00:04:02 +0100 Subject: Do not close body on err. Closes #364 --- bridge/helper/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bridge/helper') diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index bfa9e64b..9522823b 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -20,9 +20,9 @@ func DownloadFile(url string) (*[]byte, error) { } resp, err := client.Do(req) if err != nil { - resp.Body.Close() return nil, err } + defer resp.Body.Close() io.Copy(&buf, resp.Body) data := buf.Bytes() resp.Body.Close() -- cgit v1.2.3