Skip to content

Commit b9255bf

Browse files
author
Vladimir Sokolovskiy
committed
fix: memory leak in stream operations
1 parent a356b55 commit b9255bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clients/horizonclient/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ func (c *Client) stream(
158158
if err != nil {
159159
return errors.Wrap(err, "error sending HTTP request")
160160
}
161+
defer resp.Body.Close()
161162

162163
// Expected statusCode are 200-299
163164
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
164165
return fmt.Errorf("got bad HTTP status code %d", resp.StatusCode)
165166
}
166-
defer resp.Body.Close()
167167

168168
reader := bufio.NewReader(resp.Body)
169169

0 commit comments

Comments
 (0)