From d3e994377b41ce2f19ab646180d8e326f025e36c Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Thu, 11 Dec 2025 18:48:55 +0800 Subject: [PATCH] core: assign zero after resize in implementations of heap.Interface #26296 (#1841) --- core/txpool/list.go | 1 + core/types/transaction.go | 1 + 2 files changed, 2 insertions(+) diff --git a/core/txpool/list.go b/core/txpool/list.go index ef1948e261..82c87b4263 100644 --- a/core/txpool/list.go +++ b/core/txpool/list.go @@ -46,6 +46,7 @@ func (h *nonceHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] + old[n-1] = 0 // avoid memory leak *h = old[0 : n-1] return x } diff --git a/core/types/transaction.go b/core/types/transaction.go index 15f692458b..1e1cdeca6e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -704,6 +704,7 @@ func (s *TxByPriceAndTime) Pop() interface{} { old := s.txs n := len(old) x := old[n-1] + old[n-1] = nil // avoid memory leak s.txs = old[0 : n-1] return x }