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:
aaronbuchwald 2020-09-28 08:24:01 -04:00 committed by GitHub
parent 0ddd4612b7
commit eebfb13053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}