mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-17 21:46:36 +00:00
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 <martin@swende.se>
This commit is contained in:
parent
0ddd4612b7
commit
eebfb13053
1 changed files with 1 additions and 0 deletions
|
|
@ -433,6 +433,7 @@ func (h *priceHeap) Pop() interface{} {
|
||||||
old := *h
|
old := *h
|
||||||
n := len(old)
|
n := len(old)
|
||||||
x := old[n-1]
|
x := old[n-1]
|
||||||
|
old[n-1] = nil
|
||||||
*h = old[0 : n-1]
|
*h = old[0 : n-1]
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue