summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-19 15:05:44 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-19 15:05:44 +0100
commite518226713784e628ae7ee077f1b66cb12b9ffd9 (patch)
treee304eb20a74501add5a6b30e5f53de6505ad2542 /src/terminal.c
parent44c2bffde74a98acdc60505e57c70cd7cc2afa1e (diff)
downloadvim-git-e518226713784e628ae7ee077f1b66cb12b9ffd9.tar.gz
patch 8.0.1317: accessing freed memory in term_wait()v8.0.1317
Problem: Accessing freed memory in term_wait(). (Dominique Pelle) Solution: Check that the buffer still exists.
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 6cbe3433f..f1b4313ad 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3227,6 +3227,10 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
{
mch_check_messages();
parse_queued_messages();
+ if (!buf_valid(buf))
+ /* If the terminal is closed when the channel is closed the
+ * buffer disappears. */
+ break;
ui_delay(10L, FALSE);
}
mch_check_messages();