From: Bram Moolenaar Date: Sun, 19 Nov 2017 14:05:44 +0000 (+0100) Subject: patch 8.0.1317: accessing freed memory in term_wait() X-Git-Tag: v8.0.1317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e518226713784e628ae7ee077f1b66cb12b9ffd9;p=vim 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. --- 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(); diff --git a/src/version.c b/src/version.c index 99007ac5c..7e03c4b50 100644 --- a/src/version.c +++ b/src/version.c @@ -771,6 +771,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1317, /**/ 1316, /**/