]> granicus.if.org Git - vim/commitdiff
patch 7.4.800 v7.4.800
authorBram Moolenaar <Bram@vim.org>
Tue, 28 Jul 2015 12:25:48 +0000 (14:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 28 Jul 2015 12:25:48 +0000 (14:25 +0200)
Problem:    Using freed memory when triggering CmdUndefined autocommands.
Solution:   Set pointer to NULL. (Dominique Pelle)

src/ex_docmd.c
src/version.c

index 00485e359091072b59203048fecf9d6578216561..2512757598bb58242d34a86c791fd75874a7d0ec 100644 (file)
@@ -2365,8 +2365,9 @@ do_one_cmd(cmdlinep, sourcing,
        p = vim_strnsave(ea.cmd, (int)(p - ea.cmd));
        ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL);
        vim_free(p);
-       if (ret && !aborting())
-           p = find_command(&ea, NULL);
+       /* If the autocommands did something and didn't cause an error, try
+        * finding the command again. */
+       p = (ret && !aborting()) ? find_command(&ea, NULL) : NULL;
     }
 #endif
 
index 718ea31118fb88f035f4b3a964505580199597ef..cf4d74ae3cef1858bd3abf5567e75cba19f6ff0d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    800,
 /**/
     799,
 /**/