From: Bram Moolenaar Date: Sun, 5 Jan 2020 21:05:49 +0000 (+0100) Subject: patch 8.2.0089: crash when running out of memory in :setfiletype completion X-Git-Tag: v8.2.0089 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0f8055102c264b1d0c0a79bf742dc126fb447b9;p=thirdparty%2Fvim.git 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 #5438) --- 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); } } } diff --git a/src/version.c b/src/version.c index c34675f46c..c82f379cd8 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 89, /**/ 88, /**/