From eebfb13053a06433408f3b7b43837e3b2c7a8145 Mon Sep 17 00:00:00 2001 From: aaronbuchwald Date: Mon, 28 Sep 2020 08:24:01 -0400 Subject: [PATCH] core: free pointer from slice after popping element from price heap (#21572) * Fix potential memory leak in price heap * core: nil free pointer slice (alternative version) Co-authored-by: Martin Holst Swende --- core/tx_list.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/tx_list.go b/core/tx_list.go index bf304eedc..cdd3df14c 100644 --- a/core/tx_list.go +++ b/core/tx_list.go @@ -433,6 +433,7 @@ func (h *priceHeap) Pop() interface{} { old := *h n := len(old) x := old[n-1] + old[n-1] = nil *h = old[0 : n-1] return x }