diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-05 22:05:49 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-05 22:05:49 +0100 |
commit | f0f8055102c264b1d0c0a79bf742dc126fb447b9 (patch) | |
tree | 3905df547c2694e77219d4e81f695dff3a126fbc /src/cmdexpand.c | |
parent | 830c1afc9d2cd5819a05c71d4e0b1f748a8c0519 (diff) |
patch 8.2.0089: crash when running out of memory in :setfiletype completionv8.2.0089
Problem: Crash when running out of memory in :setfiletype completion.
Solution: Do not allocate memory. (Dominique Pelle, closes #5438)
Diffstat (limited to 'src/cmdexpand.c')
-rw-r--r-- | src/cmdexpand.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c index d788e27565..210b5f9819 100644 --- 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); } } } |