From f5c1314cb01164879fb9df6bce01151371c16f7d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 31 May 2020 12:06:47 -0400 Subject: [PATCH] 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 --- src/nvim/ex_getln.c | 6 +++--- 1 file 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); } } }