vim-patch:8.2.0089: crash when running out of memory in :setfiletype completion

Problem:    Crash when running out of memory in :setfiletype completion.
Solution:   Do not allocate memory. (Dominique Pelle, closes vim/vim#5438)
f0f8055102
This commit is contained in:
Jan Edmund Lazo 2020-05-31 12:06:47 -04:00
parent dd4018947c
commit f5c1314cb0
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -5361,12 +5361,12 @@ void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options)
// Concatenate new results to previous ones.
ga_grow(ga, num_p);
// take over the pointers and put them in "ga"
for (int i = 0; i < num_p; i++) {
((char_u **)ga->ga_data)[ga->ga_len] = vim_strsave(p[i]);
((char_u **)ga->ga_data)[ga->ga_len] = p[i];
ga->ga_len++;
}
FreeWild(num_p, p);
xfree(p);
}
}
}