From 8c8b114f584dcfff465607d00dc8ef3b14956fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Anda=20Estensen?= Date: Sat, 3 Dec 2022 19:36:38 +0100 Subject: [PATCH] core, p2p: avoiding leaking the popped item --- core/txpool/list.go | 1 + core/types/transaction.go | 1 + p2p/util.go | 1 + 3 files changed, 3 insertions(+) diff --git a/core/txpool/list.go b/core/txpool/list.go index eb0c753f21e9..062cbbf63e6a 100644 --- a/core/txpool/list.go +++ b/core/txpool/list.go @@ -45,6 +45,7 @@ func (h *nonceHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] + old[n-1] = 0 *h = old[0 : n-1] return x } diff --git a/core/types/transaction.go b/core/types/transaction.go index 910c68aea363..353e0e599c68 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -508,6 +508,7 @@ func (s *TxByPriceAndTime) Pop() interface{} { old := *s n := len(old) x := old[n-1] + old[n-1] = nil *s = old[0 : n-1] return x } diff --git a/p2p/util.go b/p2p/util.go index 3c5f6b8508d5..2c8f322a66ac 100644 --- a/p2p/util.go +++ b/p2p/util.go @@ -70,6 +70,7 @@ func (h *expHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] + old[n-1] = expItem{} *h = old[0 : n-1] return x }