aboutsummaryrefslogtreecommitdiff
path: root/http.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 /http.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 'http.go')
-rw-r--r--http.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/http.go b/http.go
index 4b9e113..25defad 100644
--- a/http.go
+++ b/http.go
@@ -1975,6 +1975,8 @@ func (resp *Response) String() string {
func getHTTPString(hw httpWriter) string {
w := bytebufferpool.Get()
+ defer bytebufferpool.Put(w)
+
bw := bufio.NewWriter(w)
if err := hw.Write(bw); err != nil {
return err.Error()
@@ -1983,7 +1985,6 @@ func getHTTPString(hw httpWriter) string {
return err.Error()
}
s := string(w.B)
- bytebufferpool.Put(w)
return s
}