mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
vim-patch:9.1.0341: Problem: a few memory leaks are found (#28382)
Problem: a few memory leaks are found
(LuMingYinDetect )
Solution: properly free the memory
Fixes the following problems:
- Memory leak in f_maplist()
fixes: vim/vim#14486
- Memory leak in option.c
fixes: vim/vim#14485
- Memory leak in f_resolve()
fixes: vim/vim#14484
- Memory leak in f_autocmd_get()
related: vim/vim#14474
- Memory leak in dict_extend_func()
fixes: vim/vim#14477
fixes: vim/vim#14238
closes: vim/vim#14517
29269a71b5
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
0b2b1b0185
commit
2f371ad7d0
@ -2019,6 +2019,9 @@ static void extend_dict(typval_T *argvars, const char *arg_errmsg, bool is_new,
|
||||
|
||||
action = tv_get_string_chk(&argvars[2]);
|
||||
if (action == NULL) {
|
||||
if (is_new) {
|
||||
tv_dict_unref(d1);
|
||||
}
|
||||
return; // Type error; error message already given.
|
||||
}
|
||||
size_t i;
|
||||
@ -2028,6 +2031,9 @@ static void extend_dict(typval_T *argvars, const char *arg_errmsg, bool is_new,
|
||||
}
|
||||
}
|
||||
if (i == 3) {
|
||||
if (is_new) {
|
||||
tv_dict_unref(d1);
|
||||
}
|
||||
semsg(_(e_invarg2), action);
|
||||
return;
|
||||
}
|
||||
|
@ -1441,4 +1441,10 @@ func Test_indexof()
|
||||
delfunc TestIdx
|
||||
endfunc
|
||||
|
||||
func Test_extendnew_leak()
|
||||
" This used to leak memory
|
||||
for i in range(100) | silent! call extendnew([], [], []) | endfor
|
||||
for i in range(100) | silent! call extendnew({}, {}, {}) | endfor
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user