mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 23:33:37 +00:00
vm: fix (*Stack).Clear to clean up references
This commit is contained in:
parent
930653418d
commit
fd87cd4c54
1 changed files with 3 additions and 0 deletions
|
@ -141,6 +141,9 @@ func initStack(s *Stack, n string, refc *refCounter) {
|
|||
// Clear clears all elements on the stack and set its length to 0.
|
||||
func (s *Stack) Clear() {
|
||||
if s.elems != nil {
|
||||
for _, el := range s.elems {
|
||||
s.refs.Remove(el.value)
|
||||
}
|
||||
s.elems = s.elems[:0]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue