aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-13 09:43:06 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-13 10:09:09 +0800
commit73bdfdd382bf2addd7816571608db6911448b48a (patch)
tree420b9a4c8ec18c2fb6619f4a43baf47f4c6acee3 /src/nvim/option.c
parent34c7007c32cd78b5589d72701c6669a2c378dd17 (diff)
downloadrneovim-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/option.c')
-rw-r--r--src/nvim/option.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 3c3a69e063..11a92f7d56 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3112,6 +3112,12 @@ void set_option_value_give_err(const char *name, long number, const char *string
}
}
+bool is_option_allocated(const char *name)
+{
+ int idx = findoption(name);
+ return idx >= 0 && (options[idx].flags & P_ALLOCED);
+}
+
/// Return true if "name" is a string option.
/// Returns false if option "name" does not exist.
bool is_string_option(const char *name)