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 vim/vim#5449)
8b7aa2f9b2
This commit is contained in:
Jan Edmund Lazo
2020-01-07 23:20:35 -05:00
parent e8d61005dc
commit 3d6cca5a9d

View File

@@ -4715,8 +4715,7 @@ ExpandFromContext (
int free_pat = FALSE;
int i;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
// for ":set path=" and ":set tags=" halve backslashes for escaped space
if (xp->xp_backslash != XP_BS_NONE) {
free_pat = TRUE;
pat = vim_strsave(pat);
@@ -4984,8 +4983,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
int ret;
bool did_curdir = false;
/* for ":set path=" and ":set tags=" halve backslashes for escaped
* space */
// for ":set path=" and ":set tags=" halve backslashes for escaped space
pat = vim_strsave(filepat);
for (i = 0; pat[i]; ++i)
if (pat[i] == '\\' && pat[i + 1] == ' ')