From c1b3f1994b00dbd9f70bcf593e2f51dd2621ae20 Mon Sep 17 00:00:00 2001 From: Sidhartha Mani Date: Fri, 8 Feb 2019 19:29:51 -0800 Subject: [PATCH] remove unnecessary buffer while discarding stream (#7214) --- cmd/http/close.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/http/close.go b/cmd/http/close.go index 818e665ed..f8f0e10a9 100644 --- a/cmd/http/close.go +++ b/cmd/http/close.go @@ -44,9 +44,7 @@ func DrainBody(respBody io.ReadCloser) { // Without this closing connection would disallow re-using // the same connection for future uses. // - http://stackoverflow.com/a/17961593/4465767 - bufp := b512pool.Get().(*[]byte) - defer b512pool.Put(bufp) - io.CopyBuffer(ioutil.Discard, respBody, *bufp) - respBody.Close() + defer respBody.Close() + io.Copy(ioutil.Discard, respBody) } }