From db763a535ea45edc780254c24365d9bc5f54861e Mon Sep 17 00:00:00 2001 From: j75689 Date: Tue, 26 Jul 2022 15:41:55 +0800 Subject: [PATCH] fix: memory leak issue with diff protocol --- eth/handler.go | 1 + eth/handler_diff.go | 1 + 2 files changed, 2 insertions(+) diff --git a/eth/handler.go b/eth/handler.go index 62befdbd09..aa01b444ef 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -509,6 +509,7 @@ func (h *handler) runDiffExtension(peer *diff.Peer, handler diff.Handler) error if err := h.peers.registerDiffExtension(peer); err != nil { peer.Log().Error("Diff extension registration failed", "err", err) + peer.Close() return err } return handler(peer) diff --git a/eth/handler_diff.go b/eth/handler_diff.go index 6d5436bf9a..99f174ecd3 100644 --- a/eth/handler_diff.go +++ b/eth/handler_diff.go @@ -45,6 +45,7 @@ func (h *diffHandler) RunPeer(peer *diff.Peer, hand diff.Handler) error { wait <- peer } ps.lock.Unlock() + peer.Close() return err } return (*handler)(h).runDiffExtension(peer, hand)