mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Ensure body is closed after error is checked
Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
parent
d593130fda
commit
18faf6f94e
6 changed files with 28 additions and 15 deletions
|
@ -28,6 +28,7 @@ func (s *DockerSuite) TestCliStatsNoStreamGetCpu(c *check.C) {
|
|||
var v *types.Stats
|
||||
err = json.NewDecoder(body).Decode(&v)
|
||||
c.Assert(err, check.IsNil)
|
||||
body.Close()
|
||||
|
||||
var cpuPercent = 0.0
|
||||
cpuDelta := float64(v.CpuStats.CpuUsage.TotalUsage - v.PreCpuStats.CpuUsage.TotalUsage)
|
||||
|
@ -113,6 +114,7 @@ func getNetworkStats(c *check.C, id string) types.Network {
|
|||
|
||||
err = json.NewDecoder(body).Decode(&st)
|
||||
c.Assert(err, check.IsNil)
|
||||
body.Close()
|
||||
|
||||
return st.Network
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue