Skip to content

Commit

Permalink
core: free pointer from slice after popping element from price heap (…
Browse files Browse the repository at this point in the history
…#21572)

* Fix potential memory leak in price heap

* core: nil free pointer slice (alternative version)

Co-authored-by: Martin Holst Swende <martin@swende.se>
  • Loading branch information
aaronbuchwald and holiman committed Sep 28, 2020
1 parent 0ddd461 commit eebfb13
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/tx_list.go
Expand Up @@ -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
}
Expand Down

0 comments on commit eebfb13

Please sign in to comment.