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.
4791fcd825
This commit is contained in:
zeertzjq
2022-10-13 09:43:06 +08:00
parent 34c7007c32
commit 73bdfdd382
3 changed files with 37 additions and 1 deletions

View File

@@ -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)