summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-23 12:06:00 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-23 12:06:00 +0000
commit4791fcd82565adcc60b86830e0bb6cd5b6eea0a6 (patch)
tree8d9a1ba4631efb742ea1617c99b61e0c3f85322c /src/option.c
parent2dada73a4ebffe2582af472ce362abd3116b58c9 (diff)
downloadvim-git-4791fcd82565adcc60b86830e0bb6cd5b6eea0a6.tar.gz
patch 8.2.4453: :helpgrep may free an option that was not allocatedv8.2.4453
Problem: :helpgrep may free an option that was not allocated. (Yegappan Lakshmanan) Solution: Check if the value was allocated.
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/option.c b/src/option.c
index 91ea4138d..44a0520ad 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4479,6 +4479,14 @@ get_encoding_default(void)
return (char_u *)NULL;
}
+ int
+is_option_allocated(char *name)
+{
+ int idx = findoption((char_u *)name);
+
+ return idx >= 0 && (options[idx].flags & P_ALLOCED);
+}
+
/*
* Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
* When "has_lt" is true there is a '<' before "*arg_arg".