diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-05-31 12:06:47 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-06-04 20:52:52 -0400 |
commit | f5c1314cb01164879fb9df6bce01151371c16f7d (patch) | |
tree | beca2cee5d758c7efc0429dc0ade9c7fa109b9a4 | |
parent | dd4018947c9f9b39b4e473c21ebf0e27f1e7ddc5 (diff) | |
download | rneovim-f5c1314cb01164879fb9df6bce01151371c16f7d.tar.gz rneovim-f5c1314cb01164879fb9df6bce01151371c16f7d.tar.bz2 rneovim-f5c1314cb01164879fb9df6bce01151371c16f7d.zip |
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)
https://github.com/vim/vim/commit/f0f8055102c264b1d0c0a79bf742dc126fb447b9
-rw-r--r-- | src/nvim/ex_getln.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index b799e86ff7..56a8f56753 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -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); } } } |