diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-17 06:52:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 06:52:29 +0800 |
commit | 2f371ad7d0294072d407bb05816425b5694d1935 (patch) | |
tree | fcf3cf9c05641e0755a6119c6166101e4c62412b /src/nvim/eval/funcs.c | |
parent | 0b2b1b01850a18546508007edb87866714c85dde (diff) | |
download | rneovim-2f371ad7d0294072d407bb05816425b5694d1935.tar.gz rneovim-2f371ad7d0294072d407bb05816425b5694d1935.tar.bz2 rneovim-2f371ad7d0294072d407bb05816425b5694d1935.zip |
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
https://github.com/vim/vim/commit/29269a71b5ac8a87c6c4beca35c173a19a2c9398
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index d3fe2c7e33..8e62e3b96f 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -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; } |