diff --git a/pkg/util/azure/azure.go b/pkg/util/azure/azure.go index 4fdd336c28..9c84677cbd 100644 --- a/pkg/util/azure/azure.go +++ b/pkg/util/azure/azure.go @@ -480,6 +480,7 @@ func waitForComplatetion(client *autorest.Client, req *http.Request, resp *http. if err != nil { return nil, err } + defer asyncResp.Body.Close() if asyncResp.StatusCode == 202 { if _location := asyncResp.Header.Get("Location"); len(_location) > 0 { location = _location @@ -571,6 +572,7 @@ func _jsonRequest(client *autorest.Client, method, domain, baseURL, body string) log.Errorf("Azure %s request: %s \nbody: %s error: %v", req.Method, req.URL.String(), body, err) return nil, err } + defer resp.Body.Close() if resp.StatusCode == 404 { data := []byte{}