Skip to content

Commit 427c2a6

Browse files
committed
Ensure xTransport Response.Body is closed
1 parent d7ca4c9 commit 427c2a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dnscrypt-proxy/xtransport.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ func (xTransport *XTransport) Fetch(
751751
}
752752
statusCode := 503
753753
if resp != nil {
754+
defer resp.Body.Close()
754755
statusCode = resp.StatusCode
755756
}
756757
if err != nil {
@@ -821,7 +822,6 @@ func (xTransport *XTransport) Fetch(
821822
if err != nil {
822823
return nil, statusCode, tls, rtt, err
823824
}
824-
resp.Body.Close()
825825
return bin, statusCode, tls, rtt, err
826826
}
827827

0 commit comments

Comments
 (0)