aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorGravatar Andy Pan <panjf2000@gmail.com> 2022-11-16 12:46:28 +0800
committerGravatar GitHub <noreply@github.com> 2022-11-16 06:46:28 +0200
commitc367454ffe184d396c0fabc40e7b365e4c40231f (patch)
tree203e48dc8fc922f59dd5736643408c61dbacf42c /client.go
parentUse time.Until(deadline) instead of -time.Since(deadline) (#1434) (diff)
downloadfasthttp-c367454ffe184d396c0fabc40e7b365e4c40231f.tar.gz
fasthttp-c367454ffe184d396c0fabc40e7b365e4c40231f.tar.bz2
fasthttp-c367454ffe184d396c0fabc40e7b365e4c40231f.zip
Fix some potential pool leaks (#1433)
Diffstat (limited to 'client.go')
-rw-r--r--client.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/client.go b/client.go
index a2d9b50..e445091 100644
--- a/client.go
+++ b/client.go
@@ -983,6 +983,8 @@ var clientURLResponseChPool sync.Pool
func clientPostURL(dst []byte, url string, postArgs *Args, c clientDoer) (statusCode int, body []byte, err error) {
req := AcquireRequest()
+ defer ReleaseRequest(req)
+
req.Header.SetMethod(MethodPost)
req.Header.SetContentTypeBytes(strPostArgsContentType)
if postArgs != nil {
@@ -993,7 +995,6 @@ func clientPostURL(dst []byte, url string, postArgs *Args, c clientDoer) (status
statusCode, body, err = doRequestFollowRedirectsBuffer(req, dst, url, c)
- ReleaseRequest(req)
return statusCode, body, err
}