diff options
author | Bram Moolenaar <bram@vim.org> | 2015-07-28 14:25:48 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2015-07-28 14:25:48 +0200 |
commit | 3ae336e7566eab87ab28067f7bd136355b930de7 (patch) | |
tree | 6bd437b338a4e1d920e171d1aaa920d6a06cf5cf | |
parent | d75d61999d20a0d1598ecd2f1d955e9aeef77227 (diff) | |
download | vim-3ae336e7566eab87ab28067f7bd136355b930de7.tar.gz |
Problem: Using freed memory when triggering CmdUndefined autocommands.
Solution: Set pointer to NULL. (Dominique Pelle)
-rw-r--r-- | src/ex_docmd.c | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 00485e35..25127575 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -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 diff --git a/src/version.c b/src/version.c index 718ea311..cf4d74ae 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 */ /**/ + 800, +/**/ 799, /**/ 798, |