Skip to content

Commit

Permalink
Close response body for docker stats calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwilkie committed Jan 29, 2016
1 parent d0d6cac commit 34447fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion probe/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 34447fd

Please sign in to comment.