Mercurial > vim
changeset 2617:f2927225367a v7.3.039
updated for version 7.3.039
Problem: Crash when using skk.vim plugin.
Solution: Get length of expression evaluation result only after checking for
NULL. (Noriaki Yagi, Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 27 Oct 2010 12:58:23 +0200 |
parents | 73d947c20291 |
children | fb60c9f35517 |
files | src/ex_getln.c src/version.c |
diffstat | 2 files changed, 22 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -688,24 +688,27 @@ getcmdline(firstc, count, indent) p = get_expr_line(); --textlock; restore_cmdline(&save_ccline); - len = (int)STRLEN(p); - - if (p != NULL && realloc_cmdbuff(len + 1) == OK) + + if (p != NULL) { - ccline.cmdlen = len; - STRCPY(ccline.cmdbuff, p); - vim_free(p); - - /* Restore the cursor or use the position set with - * set_cmdline_pos(). */ - if (new_cmdpos > ccline.cmdlen) - ccline.cmdpos = ccline.cmdlen; - else - ccline.cmdpos = new_cmdpos; - - KeyTyped = FALSE; /* Don't do p_wc completion. */ - redrawcmd(); - goto cmdline_changed; + len = (int)STRLEN(p); + if (realloc_cmdbuff(len + 1) == OK) + { + ccline.cmdlen = len; + STRCPY(ccline.cmdbuff, p); + vim_free(p); + + /* Restore the cursor or use the position set with + * set_cmdline_pos(). */ + if (new_cmdpos > ccline.cmdlen) + ccline.cmdpos = ccline.cmdlen; + else + ccline.cmdpos = new_cmdpos; + + KeyTyped = FALSE; /* Don't do p_wc completion. */ + redrawcmd(); + goto cmdline_changed; + } } } beep_flush();