Skip to content

Commit

Permalink
Fix connection leak (goss-org#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarDarwish authored and BenjaminHerbert committed May 28, 2020
1 parent fde81f0 commit 30c5267
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 30c5267

Please sign in to comment.