Mercurial > vim
changeset 6965:86d43639de31 v7.4.800
patch 7.4.800
Problem: Using freed memory when triggering CmdUndefined autocommands.
Solution: Set pointer to NULL. (Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 28 Jul 2015 14:25:48 +0200 |
parents | 6c62ad33faf2 |
children | f215170a8a03 |
files | src/ex_docmd.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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