diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2014-09-16 19:32:25 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2014-09-17 07:01:01 +0900 |
commit | aa66f2487edde49b9a5ba10cd70d706d06a94e25 (patch) | |
tree | 46a3fb183c6269324700890ec2d1a850c0d2560e | |
parent | fd60b8ee7e2496d08e3aa1166d171e87cb3314b9 (diff) | |
download | rneovim-aa66f2487edde49b9a5ba10cd70d706d06a94e25.tar.gz rneovim-aa66f2487edde49b9a5ba10cd70d706d06a94e25.tar.bz2 rneovim-aa66f2487edde49b9a5ba10cd70d706d06a94e25.zip |
vim-patch:7.4.369
Problem: Using freed memory when exiting while compiled with EXITFREE.
Solution: Set curwin to NULL and check for that. (Dominique Pelle)
https://code.google.com/p/vim/source/detail?r=v7-4-369
-rw-r--r-- | src/nvim/buffer.c | 4 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 7afa663fe3..11171617ef 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -4425,8 +4425,8 @@ linenr_T buf_delsign( } /* When deleted the last sign needs to redraw the windows to remove the - * sign column. */ - if (buf->b_signlist == NULL) { + * sign column. Not when curwin is NULL (this means we're exiting). */ + if (buf->b_signlist != NULL && curwin != NULL) { redraw_buf_later(buf, NOT_VALID); changed_cline_bef_curs(); } diff --git a/src/nvim/version.c b/src/nvim/version.c index c93fc5083c..bf0dace6ef 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -226,7 +226,7 @@ static int included_patches[] = { //372, 371, 370, - //369, + 369, 368, 367, //366, diff --git a/src/nvim/window.c b/src/nvim/window.c index dccf3e2efc..27fb160035 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2001,6 +2001,10 @@ void win_free_all(void) while (firstwin != NULL) (void)win_free_mem(firstwin, &dummy, NULL); + + // No window should be used after this. Set curwin to NULL to crash + // instead of using freed memory. + curwin = NULL; } #endif |