forked from aniani/vim
patch 9.0.1405: missing check for out-of-memory
Problem: Missing check for out-of-memory. Solution: Check for alloc() returning NULL pointer. (closes #12149)
This commit is contained in:
@@ -126,7 +126,6 @@ set_init_default_backupskip(void)
|
|||||||
#endif
|
#endif
|
||||||
int len;
|
int len;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
int mustfree;
|
|
||||||
char_u *item;
|
char_u *item;
|
||||||
|
|
||||||
opt_idx = findoption((char_u *)"backupskip");
|
opt_idx = findoption((char_u *)"backupskip");
|
||||||
@@ -134,7 +133,7 @@ set_init_default_backupskip(void)
|
|||||||
ga_init2(&ga, 1, 100);
|
ga_init2(&ga, 1, 100);
|
||||||
for (n = 0; n < (long)ARRAY_LENGTH(names); ++n)
|
for (n = 0; n < (long)ARRAY_LENGTH(names); ++n)
|
||||||
{
|
{
|
||||||
mustfree = FALSE;
|
int mustfree = FALSE;
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
if (*names[n] == NUL)
|
if (*names[n] == NUL)
|
||||||
# ifdef MACOS_X
|
# ifdef MACOS_X
|
||||||
@@ -150,6 +149,8 @@ set_init_default_backupskip(void)
|
|||||||
// First time count the NUL, otherwise count the ','.
|
// First time count the NUL, otherwise count the ','.
|
||||||
len = (int)STRLEN(p) + 3;
|
len = (int)STRLEN(p) + 3;
|
||||||
item = alloc(len);
|
item = alloc(len);
|
||||||
|
if (item != NULL)
|
||||||
|
{
|
||||||
STRCPY(item, p);
|
STRCPY(item, p);
|
||||||
add_pathsep(item);
|
add_pathsep(item);
|
||||||
STRCAT(item, "*");
|
STRCAT(item, "*");
|
||||||
@@ -164,6 +165,7 @@ set_init_default_backupskip(void)
|
|||||||
}
|
}
|
||||||
vim_free(item);
|
vim_free(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mustfree)
|
if (mustfree)
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
|
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1405,
|
||||||
/**/
|
/**/
|
||||||
1404,
|
1404,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user