diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-13 09:43:06 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-13 10:09:09 +0800 |
commit | 73bdfdd382bf2addd7816571608db6911448b48a (patch) | |
tree | 420b9a4c8ec18c2fb6619f4a43baf47f4c6acee3 /src/nvim/quickfix.c | |
parent | 34c7007c32cd78b5589d72701c6669a2c378dd17 (diff) | |
download | rneovim-73bdfdd382bf2addd7816571608db6911448b48a.tar.gz rneovim-73bdfdd382bf2addd7816571608db6911448b48a.tar.bz2 rneovim-73bdfdd382bf2addd7816571608db6911448b48a.zip |
vim-patch:8.2.4453: :helpgrep may free an option that was not allocated
Problem: :helpgrep may free an option that was not allocated. (Yegappan
Lakshmanan)
Solution: Check if the value was allocated.
https://github.com/vim/vim/commit/4791fcd82565adcc60b86830e0bb6cd5b6eea0a6
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f9d139c466..1b21d26dd3 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -7065,6 +7065,7 @@ void ex_helpgrep(exarg_T *eap) bool updated = false; // Make 'cpoptions' empty, the 'l' flag should not be used here. char *const save_cpo = p_cpo; + const bool save_cpo_allocated = is_option_allocated("cpo"); p_cpo = empty_option; bool new_qi = false; @@ -7104,7 +7105,9 @@ void ex_helpgrep(exarg_T *eap) if (*p_cpo == NUL) { set_option_value_give_err("cpo", 0L, save_cpo, 0); } - free_string_option(save_cpo); + if (save_cpo_allocated) { + free_string_option(save_cpo); + } } if (updated) { |