From 1bb7074feca131803350fa2c94356c38d2642273 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Sat, 26 Jul 2014 23:41:05 +0200 Subject: [PATCH] Fix HTTP connection leak upon non-OK status. Change-Id: Ie7fbd7dcc089b8306b40631be3e3d736c23c1cd3 --- retrieval/target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retrieval/target.go b/retrieval/target.go index dbf80548c..7dcc4dfab 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -246,10 +246,10 @@ func (t *target) scrape(timestamp clientmodel.Timestamp, ingester extraction.Ing if err != nil { return err } + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return fmt.Errorf("server returned HTTP status %s", resp.Status) } - defer resp.Body.Close() processor, err := extraction.ProcessorForRequestHeader(resp.Header) if err != nil {