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
|
@ -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 New Issue