From 34447fd502341904069e496fbe9b2d776da61687 Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 29 Jan 2016 10:45:20 -0800 Subject: [PATCH] Close response body for docker stats calls. --- probe/docker/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe/docker/container.go b/probe/docker/container.go index cd33e57916..308dc08c68 100644 --- a/probe/docker/container.go +++ b/probe/docker/container.go @@ -185,6 +185,7 @@ func (c *container) StartGatheringStats() error { log.Printf("docker container: %v", err) return } + defer resp.Body.Close() c.Lock() c.statsConn = conn @@ -201,7 +202,6 @@ func (c *container) StartGatheringStats() error { stats := &docker.Stats{} decoder := json.NewDecoder(resp.Body) - for err := decoder.Decode(&stats); err != io.EOF; err = decoder.Decode(&stats) { if err != nil { log.Printf("docker container: error reading event, did container stop? %v", err)