Mercurial > vim
changeset 19057:463b6fad54e9 v8.2.0089
patch 8.2.0089: crash when running out of memory in :setfiletype completion
Commit: https://github.com/vim/vim/commit/f0f8055102c264b1d0c0a79bf742dc126fb447b9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 5 22:05:49 2020 +0100
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 https://github.com/vim/vim/issues/5438)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 05 Jan 2020 22:15:33 +0100 |
parents | 369253646046 |
children | b84759ba37f2 |
files | src/cmdexpand.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -2633,16 +2633,13 @@ globpath( ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); if (ga_grow(ga, num_p) == OK) - { + // take over the pointers and put them in "ga" for (i = 0; i < num_p; ++i) { - ((char_u **)ga->ga_data)[ga->ga_len] = - vim_strnsave(p[i], (int)STRLEN(p[i])); + ((char_u **)ga->ga_data)[ga->ga_len] = p[i]; ++ga->ga_len; } - } - - FreeWild(num_p, p); + vim_free(p); } } }