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.
diff --git a/src/option.c b/src/option.c
index 91ea413..44a0520 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4479,6 +4479,14 @@
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".