浏览代码

Close resp body on plugin call error

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 93ad9c31fce375b29606ea347df28c1205e7cb41)
Brian Goff 9 年之前
父节点
当前提交
ba797dd6a2
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      pkg/plugins/client.go

+ 1 - 0
pkg/plugins/client.go

@@ -122,6 +122,7 @@ func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool)
 
 
 		if resp.StatusCode != http.StatusOK {
 		if resp.StatusCode != http.StatusOK {
 			b, err := ioutil.ReadAll(resp.Body)
 			b, err := ioutil.ReadAll(resp.Body)
+			resp.Body.Close()
 			if err != nil {
 			if err != nil {
 				return nil, &statusError{resp.StatusCode, serviceMethod, err.Error()}
 				return nil, &statusError{resp.StatusCode, serviceMethod, err.Error()}
 			}
 			}