Skip to content

Commit

Permalink
Fix connection leak (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarDarwish authored and aelsabbahy committed Apr 6, 2017
1 parent d69a85e commit ae7351d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resource/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ func ValidateContains(res ResourceRead, property string, expectedValues []string
Duration: time.Now().Sub(startTime),
}
}

defer func() {
//Do we need to close the stream?
if rc, ok := fh.(io.ReadCloser); ok {
rc.Close()
}
}()

scanner := bufio.NewScanner(fh)
var found []patternMatcher
for scanner.Scan() {
Expand Down
1 change: 1 addition & 0 deletions system/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (u *DefHTTP) setup() error {

tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: u.allowInsecure},
DisableKeepAlives: true,
}
client := &http.Client{
Transport: tr,
Expand Down

0 comments on commit ae7351d

Please sign in to comment.