summaryrefslogtreecommitdiff
path: root/src/quickfix.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/quickfix.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/quickfix.c')
-rw-r--r--src/quickfix.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 998ec6ec3..16790b030 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -8235,6 +8235,7 @@ ex_helpgrep(exarg_T *eap)
{
regmatch_T regmatch;
char_u *save_cpo;
+ int save_cpo_allocated;
qf_info_T *qi = &ql_info;
int new_qi = FALSE;
char_u *au_name = NULL;
@@ -8265,6 +8266,7 @@ ex_helpgrep(exarg_T *eap)
// Make 'cpoptions' empty, the 'l' flag should not be used here.
save_cpo = p_cpo;
+ save_cpo_allocated = is_option_allocated("cpo");
p_cpo = empty_option;
incr_quickfix_busy();
@@ -8302,7 +8304,8 @@ ex_helpgrep(exarg_T *eap)
// changed and restored, need to restore in the complicated way.
if (*p_cpo == NUL)
set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
- free_string_option(save_cpo);
+ if (save_cpo_allocated)
+ free_string_option(save_cpo);
}
if (updated)