summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-07-28 14:25:48 +0200
committerBram Moolenaar <Bram@vim.org>2015-07-28 14:25:48 +0200
commit829aef1eb48b17445b1f0a801948c1b826f507f8 (patch)
tree73f14765c4da522dacef59bc5c117efe71308afe /src/ex_docmd.c
parent6b9be1b6f29884536d99f7347fb9faa08e642e61 (diff)
patch 7.4.800v7.4.800
Problem: Using freed memory when triggering CmdUndefined autocommands. Solution: Set pointer to NULL. (Dominique Pelle)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 00485e3590..2512757598 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