forked from aniani/vim
patch 8.2.0099: use of NULL pointer when out of memory
Problem: Use of NULL pointer when out of memory. Solution: Check for NULL pointer. (Dominique Pelle, closes #5449)
This commit is contained in:
@@ -2327,7 +2327,7 @@ expand_shellcmd(
|
|||||||
char_u *path = NULL;
|
char_u *path = NULL;
|
||||||
int mustfree = FALSE;
|
int mustfree = FALSE;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
char_u *buf = alloc(MAXPATHL);
|
char_u *buf;
|
||||||
size_t l;
|
size_t l;
|
||||||
char_u *s, *e;
|
char_u *s, *e;
|
||||||
int flags = flagsarg;
|
int flags = flagsarg;
|
||||||
@@ -2337,12 +2337,18 @@ expand_shellcmd(
|
|||||||
hashitem_T *hi;
|
hashitem_T *hi;
|
||||||
hash_T hash;
|
hash_T hash;
|
||||||
|
|
||||||
|
buf = alloc(MAXPATHL);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
// for ":set path=" and ":set tags=" halve backslashes for escaped
|
// for ":set path=" and ":set tags=" halve backslashes for escaped space
|
||||||
// space
|
|
||||||
pat = vim_strsave(filepat);
|
pat = vim_strsave(filepat);
|
||||||
|
if (pat == NULL)
|
||||||
|
{
|
||||||
|
vim_free(buf);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; pat[i]; ++i)
|
for (i = 0; pat[i]; ++i)
|
||||||
if (pat[i] == '\\' && pat[i + 1] == ' ')
|
if (pat[i] == '\\' && pat[i + 1] == ' ')
|
||||||
STRMOVE(pat + i, pat + i + 1);
|
STRMOVE(pat + i, pat + i + 1);
|
||||||
|
@@ -742,6 +742,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 */
|
||||||
|
/**/
|
||||||
|
99,
|
||||||
/**/
|
/**/
|
||||||
98,
|
98,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user