]> granicus.if.org Git - vim/commitdiff
patch 8.2.0089: crash when running out of memory in :setfiletype completion v8.2.0089
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Jan 2020 21:05:49 +0000 (22:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Jan 2020 21:05:49 +0000 (22:05 +0100)
Problem:    Crash when running out of memory in :setfiletype completion.
Solution:   Do not allocate memory. (Dominique Pelle, closes #5438)

src/cmdexpand.c
src/version.c

index d788e27565e3695891d6eeff126074633cf7d771..210b5f9819a2222db970f525785f7ccd44918d96 100644 (file)
@@ -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);
            }
        }
     }
index c34675f46c54329f1fe8ff9996a08c66f7548282..c82f379cd81c0363b17f6a2909dcad2c3910556c 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    89,
 /**/
     88,
 /**/