Merge pull request #157 from pecastro/fix_tcp_connection_leak

Close client connection when done.
This commit is contained in:
Vincent Composieux 2022-11-27 10:08:25 +01:00 committed by GitHub
commit 3b7aaa0f23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,6 +201,7 @@ func (c *Client) getStatistics() (*Stats, error) {
return nil, fmt.Errorf("an error has occured during retrieving PI-Hole statistics: %w", err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("unable to read PI-Hole statistics HTTP response: %w", err)