From c791683fb8fd4c02cf495723d52f15d527c98747 Mon Sep 17 00:00:00 2001 From: Hongmin Wang Date: Wed, 19 Dec 2018 16:30:38 +0800 Subject: [PATCH] Fix memory leak in Server.connectedPeers --- net/server/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/server/server.go b/net/server/server.go index c8a20f3f..3fab6bad 100644 --- a/net/server/server.go +++ b/net/server/server.go @@ -1429,6 +1429,8 @@ func (s *Server) handleDonePeerMsg(state *peerState, sp *serverPeer) { // If we get here it means that either we didn't know about the peer // or we purposefully deleted it. + + delete(s.connectedPeers, sp.Addr()) } // handleBanPeerMsg deals with banning peers. It is invoked from the @@ -2047,6 +2049,7 @@ func (s *Server) peerDoneHandler(sp *serverPeer) { log.Debug("Evicted %d from peer %v (id %d)", numEvicted, sp, sp.ID()) } } + close(sp.quit) }