diff src/terminal.c @ 12881:1c05b29ab125 v8.0.1317

patch 8.0.1317: accessing freed memory in term_wait() commit https://github.com/vim/vim/commit/e518226713784e628ae7ee077f1b66cb12b9ffd9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 19 15:05:44 2017 +0100 patch 8.0.1317: accessing freed memory in term_wait() Problem: Accessing freed memory in term_wait(). (Dominique Pelle) Solution: Check that the buffer still exists.
author Christian Brabandt <cb@256bit.org>
date Sun, 19 Nov 2017 15:15:05 +0100
parents ebb4f6c93598
children 40ae30bc2691
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3227,6 +3227,10 @@ f_term_wait(typval_T *argvars, typval_T 
 	{
 	    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();