mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 07:18:17 +00:00
eval: Remove dictwatcher from watchers queue before freeing it
This fixes a use-after-free noticed by ASAN which would occur when a dictwatcher was still active on a dictionary when the dictionary was freed. fun! MakeWatch() let d = {'foo': 'bar'} call dictwatcheradd(d, 'foo', function('...')) endfun Patch-by: oni-link Closes #5930
This commit is contained in:
@@ -6410,8 +6410,8 @@ static void dict_free_contents(dict_T *d) {
|
||||
while (!QUEUE_EMPTY(&d->watchers)) {
|
||||
QUEUE *w = QUEUE_HEAD(&d->watchers);
|
||||
DictWatcher *watcher = dictwatcher_node_data(w);
|
||||
dictwatcher_free(watcher);
|
||||
QUEUE_REMOVE(w);
|
||||
dictwatcher_free(watcher);
|
||||
}
|
||||
|
||||
hash_clear(&d->dv_hashtab);
|
||||
|
Reference in New Issue
Block a user