To:
[email protected]
Subject: Patch 7.2b.004
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.2b.004
Problem: Trying to free memory for a static string when using ":helpgrep".
(George Reilly)
Solution: Set 'cpo' to empty_option instead of an empty string. Also for
searchpair() and substitute().
Files: src/quickfix.c, src/eval.c
*** ../vim-7.2b.003/src/quickfix.c Sun Jul 13 19:15:19 2008
--- src/quickfix.c Mon Jul 14 19:54:22 2008
***************
*** 3779,3785 ****
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
! p_cpo = (char_u *)"";
#ifdef FEAT_MULTI_LANG
/* Check for a specified language */
--- 3779,3785 ----
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
! p_cpo = empty_option;
#ifdef FEAT_MULTI_LANG
/* Check for a specified language */
***************
*** 3889,3895 ****
qi->qf_lists[qi->qf_curlist].qf_index = 1;
}
! p_cpo = save_cpo;
#ifdef FEAT_WINDOWS
qf_update_buffer(qi);
--- 3889,3899 ----
qi->qf_lists[qi->qf_curlist].qf_index = 1;
}
! if (p_cpo == empty_option)
! p_cpo = save_cpo;
! else
! /* Darn, some plugin changed the value. */
! free_string_option(save_cpo);
#ifdef FEAT_WINDOWS
qf_update_buffer(qi);
*** ../vim-7.2b.003/src/eval.c Sun Jul 13 19:15:10 2008
--- src/eval.c Mon Jul 14 23:03:12 2008
***************
*** 14997,15003 ****
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
! p_cpo = (char_u *)"";
#ifdef FEAT_RELTIME
/* Set the time limit, if there is one. */
--- 14997,15003 ----
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
save_cpo = p_cpo;
! p_cpo = empty_option;
#ifdef FEAT_RELTIME
/* Set the time limit, if there is one. */
***************
*** 15112,15118 ****
theend:
vim_free(pat2);
vim_free(pat3);
! p_cpo = save_cpo;
return retval;
}
--- 15112,15122 ----
theend:
vim_free(pat2);
vim_free(pat3);
! if (p_cpo == empty_option)
! p_cpo = save_cpo;
! else
! /* Darn, evaluating the {skip} expression changed the value. */
! free_string_option(save_cpo);
return retval;
}
***************
*** 22503,22509 ****
/* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
save_cpo = p_cpo;
! p_cpo = (char_u *)"";
ga_init2(&ga, 1, 200);
--- 22507,22513 ----
/* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
save_cpo = p_cpo;
! p_cpo = empty_option;
ga_init2(&ga, 1, 200);
***************
*** 22564,22570 ****
ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
ga_clear(&ga);
! p_cpo = save_cpo;
return ret;
}
--- 22568,22578 ----
ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
ga_clear(&ga);
! if (p_cpo == empty_option)
! p_cpo = save_cpo;
! else
! /* Darn, evaluating {sub} expression changed the value. */
! free_string_option(save_cpo);
return ret;
}
*** ../vim-7.2b.003/src/version.c Mon Jul 14 21:47:27 2008
--- src/version.c Mon Jul 14 23:01:13 2008
***************
*** 678,679 ****
--- 678,681 ----
{ /* Add new patch number below this line */
+ /**/
+ 4,
/**/
--
Hear about the guy who played a blank tape at full blast?
The mime next door went nuts.
/// Bram Moolenaar --
[email protected] --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute --
http://www.A-A-P.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///