mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.1502: in out-of-memory situation character is not restored
Problem: In out-of-memory situation character is not restored. (Coverity) Solution: Restore the character in all situations.
This commit is contained in:
@@ -5315,8 +5315,9 @@ ExpandUserDefined(
|
|||||||
char_u *retstr;
|
char_u *retstr;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *e;
|
char_u *e;
|
||||||
char_u keep;
|
int keep;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
|
int skip;
|
||||||
|
|
||||||
retstr = call_user_expand_func(call_func_retstr, xp, num_file, file);
|
retstr = call_user_expand_func(call_func_retstr, xp, num_file, file);
|
||||||
if (retstr == NULL)
|
if (retstr == NULL)
|
||||||
@@ -5329,23 +5330,19 @@ ExpandUserDefined(
|
|||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
e = s + STRLEN(s);
|
e = s + STRLEN(s);
|
||||||
keep = *e;
|
keep = *e;
|
||||||
*e = 0;
|
*e = NUL;
|
||||||
|
|
||||||
if (xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0)
|
skip = xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0;
|
||||||
|
*e = keep;
|
||||||
|
|
||||||
|
if (!skip)
|
||||||
{
|
{
|
||||||
*e = keep;
|
if (ga_grow(&ga, 1) == FAIL)
|
||||||
if (*e != NUL)
|
break;
|
||||||
++e;
|
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s));
|
||||||
continue;
|
++ga.ga_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ga_grow(&ga, 1) == FAIL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s));
|
|
||||||
++ga.ga_len;
|
|
||||||
|
|
||||||
*e = keep;
|
|
||||||
if (*e != NUL)
|
if (*e != NUL)
|
||||||
++e;
|
++e;
|
||||||
}
|
}
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1502,
|
||||||
/**/
|
/**/
|
||||||
1501,
|
1501,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user