0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-02-23 12:06:00 +00:00
parent 2dada73a4e
commit 4791fcd825
5 changed files with 42 additions and 1 deletions

View File

@@ -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".