Mercurial > vim
diff src/misc1.c @ 6596:f8f2a61e538d v7.4.624
updated for version 7.4.624
Problem: May leak memory or crash when vim_realloc() returns NULL.
Solution: Handle a NULL value properly. (Mike Williams)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 10 Feb 2015 18:34:01 +0100 |
parents | 96a4fa8e530c |
children | 056809de0b29 |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -3431,10 +3431,14 @@ get_keystroke() buf = alloc(buflen); else if (maxlen < 10) { + char_u *t_buf = buf; + /* Need some more space. This might happen when receiving a long * escape sequence. */ buflen += 100; buf = vim_realloc(buf, buflen); + if (buf == NULL) + vim_free(t_buf); maxlen = (buflen - 6 - len) / 3; } if (buf == NULL)