trie/bintrie: free hashed node slot after iterator resolution

This commit is contained in:
CPerezz 2026-04-15 22:52:53 +02:00
parent 7351d8d1c1
commit a9a2d5653c
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -139,6 +139,7 @@ func (it *binaryNodeIterator) Next(descend bool) bool {
} }
// Update the stack and parent with the resolved node // Update the stack and parent with the resolved node
oldHashedIdx := it.current.Index()
it.current = resolved it.current = resolved
it.stack[len(it.stack)-1].Node = resolved it.stack[len(it.stack)-1].Node = resolved
parent := &it.stack[len(it.stack)-2] parent := &it.stack[len(it.stack)-2]
@ -148,6 +149,7 @@ func (it *binaryNodeIterator) Next(descend bool) bool {
} else { } else {
parentNode.right = resolved parentNode.right = resolved
} }
it.store.freeHashedNode(oldHashedIdx)
return it.Next(descend) return it.Next(descend)
case KindEmpty: case KindEmpty: