mirror of
https://github.com/neovim/neovim.git
synced 2026-07-09 19:09:39 +00:00
Merge pull request #40559 from zeertzjq/vim-9.2.0770
vim-patch:9.2.{0770,0771}
This commit is contained in:
@@ -2494,11 +2494,14 @@ int tv_dict_add_list(dict_T *const d, const char *const key, const size_t key_le
|
||||
|
||||
item->di_tv.v_type = VAR_LIST;
|
||||
item->di_tv.vval.v_list = list;
|
||||
tv_list_ref(list);
|
||||
if (tv_dict_add(d, item) == FAIL) {
|
||||
// Detach "list" so tv_dict_item_free() does not unref it: on failure
|
||||
// ownership stays with the caller.
|
||||
item->di_tv.vval.v_list = NULL;
|
||||
tv_dict_item_free(item);
|
||||
return FAIL;
|
||||
}
|
||||
tv_list_ref(list);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2537,11 +2540,14 @@ int tv_dict_add_dict(dict_T *const d, const char *const key, const size_t key_le
|
||||
|
||||
item->di_tv.v_type = VAR_DICT;
|
||||
item->di_tv.vval.v_dict = dict;
|
||||
dict->dv_refcount++;
|
||||
if (tv_dict_add(d, item) == FAIL) {
|
||||
// Detach "dict" so tv_dict_item_free() does not unref it: on failure
|
||||
// ownership stays with the caller.
|
||||
item->di_tv.vval.v_dict = NULL;
|
||||
tv_dict_item_free(item);
|
||||
return FAIL;
|
||||
}
|
||||
dict->dv_refcount++;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user