From 29064448cb2e3a352ad0089b56a0b747725d0ac0 Mon Sep 17 00:00:00 2001 From: David Hill Date: Sat, 21 Sep 2019 13:40:39 -0400 Subject: [PATCH] rpcclient: close the unused response body --- rpcclient/infrastructure.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index ff932bc8..16b2144f 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1222,6 +1222,9 @@ func dial(config *ConnConfig) (*websocket.Conn, error) { // Dial the connection. url := fmt.Sprintf("%s://%s/%s", scheme, config.Host, config.Endpoint) wsConn, resp, err := dialer.Dial(url, requestHeader) + if resp != nil { + resp.Body.Close() + } if err != nil { if err != websocket.ErrBadHandshake || resp == nil { return nil, err